/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CiaAerea;

import java.awt.*;
import java.awt.event.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;

/**
 *
 * @author Thomas
 */
public class Interface extends JFrame {

    private CiaAerea sistema;

    /**
     * @param args the command line arguments
     */
    public Interface(CiaAerea dados) throws Exception {

        StartHome();

        StartCliente();
        StartAeronave();
        StartDestino();
        StartVoo();
        StartReserva();
        StartFaturamento();
        this.sistema = dados;

    }

    public void StartHome() {
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(700, 390);
        frame.setVisible(true);

        //Iniciando o CardLayout
        cardsCliente = new JPanel(new CardLayout());
        cardsAeronave = new JPanel(new CardLayout());
        cardsDestino = new JPanel(new CardLayout());
        cardsVoo = new JPanel(new CardLayout());
        cardsReserva = new JPanel(new CardLayout());

        //Iniciando a abas
        Abas = new JTabbedPane();
        //Criando um painel para colocar a mensagem
        PHome = new JPanel(new BorderLayout());

        //Mensagem
        JLabel mensagem = new JLabel("                          Bem-Vindo ao Sistema AirTurtle");

        //Adicionando a mensagem ao painel
        PHome.add(mensagem);

        //Adicionando o Painel a aba
        Abas.add("Home", PHome);

    }

    public void StartCliente() throws Exception {
        //Iniciando o painel da aba cliente        
        PCliente = new JPanel(new BorderLayout());

        //Criando um subPainel só para os botões
        JPanel Pbotoes = new JPanel(new GridLayout(8, 1));

        //Criando os 4 botões
        BCadastrarCliente = new JButton("Cadastrar");
        BCadastrarCliente.addActionListener(new CadastrarCliente());
        BAlterarCliente = new JButton("Alterar");
        BAlterarCliente.addActionListener(new AlterarCliente());
        BRemoverCliente = new JButton("Remover");
        BRemoverCliente.addActionListener(new RemoverCliente());
        BConsultarCliente = new JButton("Consultar");
        BConsultarCliente.addActionListener(new ConsultarCliente());

        //Adicionando os botões ao painel de botões
        Pbotoes.add(new JLabel("Escolha uma das opções a seguir:"));
        Pbotoes.add(BCadastrarCliente);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BAlterarCliente);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BRemoverCliente);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BConsultarCliente);

        //Paines pré-configurados
        PainelCadastrarCliente();
        PainelConsultarCliente();
        PainelAlterarCliente();
        PainelRemoverCliente();

        //Adicionando os painéis ao cardlayout
        cardsCliente.add(PCadastrarCliente, "CadastrarCliente");
        cardsCliente.add(PConsultarCliente, "ConsultarCliente");
        cardsCliente.add(PAlterarCliente, "AlterarCliente");
        cardsCliente.add(PRemoverCliente, "RemoverCliente");

        //Adicionando os paineis dos botoes e exibição ao painel principal
        PCliente.add(BorderLayout.WEST, Pbotoes);
        PCliente.add(BorderLayout.EAST, cardsCliente);

        //Adicionando o painel principal a aba
        Abas.addTab("Cliente", PCliente);
    }

    public void StartAeronave() throws Exception {
        //Iniciando o painel da aba aeronave        
        PAeronave = new JPanel(new BorderLayout());

        //Criando um subPainel só para os botões
        JPanel Pbotoes = new JPanel(new GridLayout(8, 1));
        //Criando os 4 botões
        BCadastrarAeronave = new JButton("Cadastrar");
        BCadastrarAeronave.addActionListener(new CadastrarAeronave());
        BAlterarAeronave = new JButton("Alterar");
        BAlterarAeronave.addActionListener(new AlterarAeronave());
        BRemoverAeronave = new JButton("Remover");
        BRemoverAeronave.addActionListener(new RemoverAeronave());
        BConsultarAeronave = new JButton("Consultar");
        BConsultarAeronave.addActionListener(new ConsultarAeronave());

        //Adicionando os botões ao painel de botões
        Pbotoes.add(new JLabel("Escolha uma das opções a seguir:"));
        Pbotoes.add(BCadastrarAeronave);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BAlterarAeronave);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BRemoverAeronave);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BConsultarAeronave);

        //Paines pré-configurados
        PainelCadastrarAeronave();
        PainelConsultarAeronave();
        PainelAlterarAeronave();
        PainelRemoverAeronave();

        //Adicionando os painéis ao cardlayout
        cardsAeronave.add(PCadastrarAeronave, "CadastrarAeronave");
        cardsAeronave.add(PConsultarAeronave, "ConsultarAeronave");
        cardsAeronave.add(PAlterarAeronave, "AlterarAeronave");
        cardsAeronave.add(PRemoverAeronave, "RemoverAeronave");

        //Adicionando os paineis dos botoes e exibição ao painel principal
        PAeronave.add(BorderLayout.WEST, Pbotoes);
        PAeronave.add(BorderLayout.CENTER, cardsAeronave);

        //Adicionando o painel principal a aba
        Abas.addTab("Aeronave", PAeronave);


    }

    public void StartDestino() throws Exception {
        //Iniciando o painel da aba cliente        
        PDestino = new JPanel(new BorderLayout());

        //Criando um subPainel só para os botões
        JPanel Pbotoes = new JPanel(new GridLayout(8, 1));
        //Criando os 4 botões
        BCadastrarDestino = new JButton("Cadastrar");
        BCadastrarDestino.addActionListener(new CadastrarDestino());
        BAlterarDestino = new JButton("Alterar");
        BAlterarDestino.addActionListener(new AlterarDestino());
        BRemoverDestino = new JButton("Remover");
        BRemoverDestino.addActionListener(new RemoverDestino());
        BConsultarDestino = new JButton("Consultar");
        BConsultarDestino.addActionListener(new ConsultarDestino());

        //Adicionando os botões ao painel de botões
        Pbotoes.add(new JLabel("Escolha uma das opções a seguir:"));
        Pbotoes.add(BCadastrarDestino);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BAlterarDestino);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BRemoverDestino);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BConsultarDestino);

        //Paines pré-configurados
        PainelCadastrarDestino();
        PainelConsultarDestino();
        PainelAlterarDestino();
        PainelRemoverDestino();

        //Adicionando os painéis ao cardlayout
        cardsDestino.add(PCadastrarDestino, "CadastrarDestino");
        cardsDestino.add(PConsultarDestino, "ConsultarDestino");
        cardsDestino.add(PAlterarDestino, "AlterarDestino");
        cardsDestino.add(PRemoverDestino, "RemoverDestino");

        //Adicionando os paineis dos botoes e exibição ao painel principal
        PDestino.add(BorderLayout.WEST, Pbotoes);
        PDestino.add(BorderLayout.EAST, cardsDestino);

        //Adicionando o painel principal a aba
        Abas.addTab("Destino", PDestino);


    }

    public void StartVoo() {
        //Iniciando o painel da aba Voo       
        PVoo = new JPanel(new BorderLayout());

        //Criando um subPainel só para os botões
        JPanel Pbotoes = new JPanel(new GridLayout(8, 1));
        //Criando os 4 botões
        BCadastrarVoo = new JButton("Cadastrar");
        BCadastrarVoo.addActionListener(new CadastrarVoo());
        BAlterarVoo = new JButton("Alterar");
        BAlterarVoo.addActionListener(new AlterarVoo());
        BRemoverVoo = new JButton("Remover");
        BRemoverVoo.addActionListener(new RemoverVoo());
        BConsultarVoo = new JButton("Consultar");
        BConsultarVoo.addActionListener(new ConsultarVoo());

        //Adicionando os botões ao painel de botões
        Pbotoes.add(new JLabel("Escolha uma das opções a seguir:"));
        Pbotoes.add(BCadastrarVoo);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BAlterarVoo);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BRemoverVoo);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BConsultarVoo);

        //Paines pré-configurados
        PainelCadastrarVoo();
        PainelConsultarVoo();
        PainelAlterarVoo();
        PainelRemoverVoo();

        cardsVoo.add(PCadastrarVoo, "CadastrarVoo");
        cardsVoo.add(PConsultarVoo, "ConsultarVoo");
        cardsVoo.add(PAlterarVoo, "AlterarVoo");
        cardsVoo.add(PRemoverVoo, "RemoverVoo");

        //Adicionando os paineis dos botoes e exibição ao painel principal
        PVoo.add(BorderLayout.WEST, Pbotoes);
        PVoo.add(BorderLayout.EAST, cardsVoo);

        //Adicionando o painel principal a aba
        Abas.addTab("Vôo", PVoo);
    }

    public void StartReserva() {
        //Iniciando o painel da aba Reserva       
        PReserva = new JPanel(new BorderLayout());

        //Criando um subPainel só para os botões
        JPanel Pbotoes = new JPanel(new GridLayout(8, 1));
        //Criando os 4 botões
        BCadastrarReserva = new JButton("Cadastrar");
        BCadastrarReserva.addActionListener(new CadastrarReserva());
        BRemoverReserva = new JButton("Remover");
        BRemoverReserva.addActionListener(new RemoverReserva());
        BConsultarReserva = new JButton("Consultar");
        BConsultarReserva.addActionListener(new ConsultarReserva());

        //Adicionando os botões ao painel de botões
        Pbotoes.add(new JLabel("Escolha uma das opções a seguir:"));
        Pbotoes.add(BCadastrarReserva);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BRemoverReserva);
        Pbotoes.add(new JLabel(""));
        Pbotoes.add(BConsultarReserva);

        PainelCadastrarReserva();
        PainelRemoverReserva();
        PainelConsultarReserva();

        cardsReserva.add(PCadastrarReserva, "CadastrarReserva");
        cardsReserva.add(PRemoverReserva, "RemoverReserva");
        cardsReserva.add(PConsultarReserva, "ConsultarReserva");
        //Adicionando os paineis dos botoes e exibição ao painel principal
        PReserva.add(BorderLayout.WEST, Pbotoes);
        PReserva.add(BorderLayout.EAST, cardsReserva);

        //Adicionando o painel principal a aba
        Abas.addTab("Reserva", PReserva);



    }

    public void StartFaturamento() {
        //Iniciando o painel da aba Faturamento      
        PFaturamento = new JPanel(new BorderLayout());

        //Adicinando subPaineis
        JPanel PTexto = new JPanel(new GridLayout(2, 1));
        JPanel PCampos = new JPanel(new GridLayout(2, 1));

        //Adicionando os label e textfield
        JLabel lblotimista = new JLabel("Faturamento Otimista");
        final JTextField txtotimista = new JTextField(40);
        JLabel lblpessimista = new JLabel("Faturamento pessimista");
        final JTextField txtpessimista = new JTextField(40);

        PTexto.add(lblotimista);
        PTexto.add(lblpessimista);
        PCampos.add(txtotimista);
        PCampos.add(txtpessimista);

        //Adicionando o botão
        BCalcular = new JButton("Calcular");
        BCalcular.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //Adicionando as funcionalidades para calculo das faturas otimistas e pessimistas
                txtotimista.setText(sistema.estimarFaturamentoOtimista() + "");
                txtpessimista.setText(sistema.estimarFaturamentoPessimista() + "");
            }
        });

        PFaturamento.add(BorderLayout.WEST, PTexto);
        PFaturamento.add(BorderLayout.EAST, PCampos);
        PFaturamento.add(BorderLayout.SOUTH, BCalcular);

        Abas.addTab("Faturamento", PFaturamento);

        //Adicionando aba a janela
        frame.getContentPane().add(Abas);
    }

    public void PainelCadastrarCliente() throws Exception {
        PCadastrarCliente = new JPanel();

        final JLabel lblnum = new JLabel();
        final JLabel lblbairro = new JLabel();
        final JLabel lblcomplemento = new JLabel();
        final JRadioButton jRadioButton1 = new JRadioButton();
        final JLabel lblfidelidade = new JLabel();
        final JRadioButton jRadioButton2 = new JRadioButton();
        final JLabel lblrua = new JLabel();
        final JLabel lblnumfidelidade = new JLabel();
        final JTextField txtnumfidelidade = new JTextField();
        final JLabel lblcelular = new JLabel();
        final JTextField txtcelular = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JLabel lblcep = new JLabel();
        final JLabel lblestado = new JLabel();
        final JLabel lblpais = new JLabel();
        final JLabel lblendereco = new JLabel();
        final JTextField txtrua = new JTextField();
        final JTextField txtbairro = new JTextField();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JTextField txtcep = new JTextField();
        final JTextField txtcpf = new JTextField();
        final JLabel lblcpf = new JLabel();
        final JTextField txttelefone = new JTextField();
        final JTextField txtcidade = new JTextField();
        final JTextField txtemail = new JTextField();
        final JLabel lblemail = new JLabel();
        final JTextField txtpais = new JTextField();
        final JTextField txtnome = new JTextField();
        final JTextField txtestado = new JTextField();
        final JLabel lblnome = new JLabel();
        final JLabel lbltelefone = new JLabel();
        btnConfirmarCadastro = new JButton();
        btnConfirmarCadastro.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    //Cadastrando Endereco para cliente - String rua, String bairro, String complemento, String numero, String CEP, String cidade, String estado, String pais
                    Endereco enderecoCliente = new Endereco(txtrua.getText().toString(), txtbairro.getText().toString(), txtcomplemento.getText().toString(), txtnum.getText().toString(), txtcep.getText().toString(), txtcidade.getText().toString(), txtestado.getText().toString(), txtpais.getText().toString());
                    //Cadastrando Cliente - String nome, String cpf, String eMail, String telefone, String celular, boolean isClienteFidelidade, String numeroFidelidade, Endereco end     
                   //sistema.cadastrarCliente(txtnome.getText().toString(), txtcpf.getText().toString(), txtemail.getText().toString(), txttelefone.getText().toString(), txtcelular.getText().toString(), jRadioButton1.isSelected(), txtnumfidelidade.getText().toString(), enderecoCliente);
                   ClienteSerialize dados = new ClienteSerialize(txtnome.getText().toString(), txtcpf.getText().toString(), txtemail.getText().toString(), txttelefone.getText().toString(), txtcelular.getText().toString(), jRadioButton1.isSelected(), txtnumfidelidade.getText().toString(), enderecoCliente);
                   dados.escrever(dados);
                   
                    JOptionPane.showMessageDialog(null, "Cliente cadastrado com sucesso");
                    
        txtnum.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtrua.setText("");
        txtnumfidelidade.setText("");
        txtcelular.setText("");
        txtcidade.setText("");
        txtcep.setText("");
        txtestado.setText("");
        txtpais.setText("");
        txtcpf.setText("");
        txtemail.setText("");
        txtnome.setText("");
        txttelefone.setText("");
         
                    PainelCadastrarCliente();
                } catch (Exception er) {
                    JOptionPane.showMessageDialog(null, er.getMessage());
                }
            }
        });

        lblnum.setText("N°");
        lblbairro.setText("Bairro");
        lblcomplemento.setText("Complemento");
        jRadioButton1.setText("Sim");
        lblfidelidade.setText("Fidelidade");
        jRadioButton2.setText("Não");
        lblrua.setText("Rua");
        lblnumfidelidade.setText("Numero");
        lblcelular.setText("Celular");
        lblcidade.setText("Cidade");
        lblcep.setText("CEP");
        lblestado.setText("Estado");
        lblpais.setText("País");
        lblendereco.setText("Endereço");
        lblcpf.setText("CPF");
        lblemail.setText("Email");
        lblnome.setText("Nome");
        lbltelefone.setText("Telefone");
        btnConfirmarCadastro.setText("Cadastrar");

        GroupLayout PCadastrarLayout = new GroupLayout(PCadastrarCliente);
        PCadastrarCliente.setLayout(PCadastrarLayout);
        PCadastrarLayout.setHorizontalGroup(
                PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PCadastrarLayout.createSequentialGroup()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblfidelidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton2)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblnumfidelidade)
                .addGap(9, 9, 9))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lbltelefone)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblcelular))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblnome)
                .addGap(18, 18, 18)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(12, 12, 12)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtcelular)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblemail)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtemail, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE))
                .addComponent(txtnumfidelidade)))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblnum)
                .addGap(25, 25, 25)
                .addComponent(txtnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblbairro)
                .addComponent(lblcep, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtbairro)
                .addComponent(txtcep, GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblendereco)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblcpf)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtcidade)
                .addGap(18, 18, 18)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblpais)
                .addGap(29, 29, 29)
                .addComponent(txtpais))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnConfirmarCadastro)))));
        PCadastrarLayout.setVerticalGroup(
                PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PCadastrarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcpf)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(23, 23, 23)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnome)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtemail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblemail)))
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtnumfidelidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnumfidelidade)))
                .addGroup(PCadastrarLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcelular)
                .addComponent(txtcelular, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbltelefone))
                .addGap(15, 15, 15)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfidelidade)
                .addComponent(jRadioButton1)
                .addComponent(jRadioButton2))))
                .addGap(18, 18, 18)
                .addComponent(lblendereco)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PCadastrarLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(lblestado)
                .addComponent(lblpais)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnConfirmarCadastro)
                .addGap(41, 41, 41)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PCadastrarCliente, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE)));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(PCadastrarCliente, GroupLayout.PREFERRED_SIZE, 294, Short.MAX_VALUE)
                .addContainerGap()));

    }

    public void PainelConsultarCliente() {

        PConsultarCliente = new JPanel();
        final JLabel lblnum = new JLabel();
        final JLabel lblbairro = new JLabel();
        final JLabel lblcomplemento = new JLabel();
        final JRadioButton jRadioButton1 = new JRadioButton();
        final JLabel lblfidelidade = new JLabel();
        final JRadioButton jRadioButton2 = new JRadioButton();
        final JLabel lblrua = new JLabel();
        final JLabel lblnumfidelidade = new JLabel();
        final JTextField txtnumfidelidade = new JTextField();
        final JLabel lblcelular = new JLabel();
        final JTextField txtcelular = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JLabel lblcep = new JLabel();
        final JLabel lblestado = new JLabel();
        final JLabel lblpais = new JLabel();
        final JLabel lblendereco = new JLabel();
        final JTextField txtrua = new JTextField();
        final JTextField txtbairro = new JTextField();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JTextField txtcep = new JTextField();
        final JTextField txtcpf = new JTextField();
        final JLabel lblcpf = new JLabel();
        final JTextField txttelefone = new JTextField();
        final JTextField txtcidade = new JTextField();
        final JTextField txtemail = new JTextField();
        final JLabel lblemail = new JLabel();
        final JTextField txtpais = new JTextField();
        final JTextField txtnome = new JTextField();
        final JTextField txtestado = new JTextField();
        final JLabel lblnome = new JLabel();
        final JLabel lbltelefone = new JLabel();
        JButton btnConsultarCliente = new JButton();

        btnConsultarCliente.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    ClienteSerialize dados = new ClienteSerialize();
                    dados = dados.ler(txtcpf.getText().toString());
                     txtnome.setText(dados.getNome());
                     txtemail.setText(dados.geteMail());
                     txttelefone.setText(dados.getTelefone());
                     txtcelular.setText(dados.getCelular());
                     txtnumfidelidade.setText(dados.getNumeroFidelidade());
                     txtrua.setText(dados.getEnd().getRua());
                     txtbairro.setText(dados.getEnd().getBairro());
                     txtnum.setText(dados.getEnd().getNumero());
                     txtcomplemento.setText(dados.getEnd().getComplemento());
                     txtcep.setText(dados.getEnd().getCEP());
                     txtcidade.setText(dados.getEnd().getCidade());
                     txtestado.setText(dados.getEnd().getEstado());
                     txtpais.setText(dados.getEnd().getPais());
                     jRadioButton1.setSelected(dados.isIsFidelidade());
                     
                    /*txtnome.setText(sistema.getCliente(txtcpf.getText().toString()).getNome());
                    txtemail.setText(sistema.getCliente(txtcpf.getText().toString()).geteMail());
                    txttelefone.setText(sistema.getCliente(txtcpf.getText().toString()).getTelefone());
                    txtcelular.setText(sistema.getCliente(txtcpf.getText().toString()).getCelular());
                    txtnumfidelidade.setText(sistema.getCliente(txtcpf.getText().toString()).getNumeroFidelidade());
                    txtrua.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getRua());
                    txtbairro.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getBairro());
                    txtnum.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getNumero());
                    txtcomplemento.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getComplemento());
                    txtcep.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCEP());
                    txtcidade.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCidade());
                    txtestado.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getEstado());
                    txtpais.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getPais());
                    jRadioButton1.setSelected(sistema.getCliente(txtcpf.getText().toString()).getIsClienteFidelidade());*/
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        lblnum.setText("N°");
        lblbairro.setText("Bairro");
        lblcomplemento.setText("Complemento");
        jRadioButton1.setText("Sim");
        lblfidelidade.setText("Fidelidade");
        jRadioButton2.setText("Não");
        lblrua.setText("Rua");
        lblnumfidelidade.setText("Numero");
        lblcelular.setText("Celular");
        lblcidade.setText("Cidade");
        lblcep.setText("CEP");
        lblestado.setText("Estado");
        lblpais.setText("País");
        lblendereco.setText("Endereço");
        lblcpf.setText("CPF");
        lblemail.setText("Email");
        lblnome.setText("Nome");
        lbltelefone.setText("Telefone");
        btnConsultarCliente.setText("Consultar");

        GroupLayout PConsultarClienteLayout = new GroupLayout(PConsultarCliente);
        PConsultarCliente.setLayout(PConsultarClienteLayout);
        PConsultarClienteLayout.setHorizontalGroup(
                PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PConsultarClienteLayout.createSequentialGroup()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblfidelidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton2)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblnumfidelidade)
                .addGap(9, 9, 9))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lbltelefone)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblcelular))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblnome)
                .addGap(18, 18, 18)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(12, 12, 12)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtcelular)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblemail)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtemail, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE))
                .addComponent(txtnumfidelidade)))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblnum)
                .addGap(25, 25, 25)
                .addComponent(txtnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblbairro)
                .addComponent(lblcep, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtbairro)
                .addComponent(txtcep, GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblendereco)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblcpf)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarCliente)))
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtcidade)
                .addGap(18, 18, 18)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblpais)
                .addGap(29, 29, 29)
                .addComponent(txtpais)))));
        PConsultarClienteLayout.setVerticalGroup(
                PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PConsultarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcpf)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarCliente))
                .addGap(21, 21, 21)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnome)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtemail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblemail)))
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtnumfidelidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnumfidelidade)))
                .addGroup(PConsultarClienteLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcelular)
                .addComponent(txtcelular, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbltelefone))
                .addGap(15, 15, 15)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfidelidade)
                .addComponent(jRadioButton1)
                .addComponent(jRadioButton2))))
                .addGap(18, 18, 18)
                .addComponent(lblendereco)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PConsultarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(lblestado)
                .addComponent(lblpais)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(70, 70, 70)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarCliente, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addComponent(PConsultarCliente, GroupLayout.PREFERRED_SIZE, 264, GroupLayout.PREFERRED_SIZE)
                .addGap(0, 63, Short.MAX_VALUE)));
    }

    public void PainelAlterarCliente() throws Exception {
        PAlterarCliente = new JPanel();
        final JLabel lblnum = new JLabel();
        final JLabel lblbairro = new JLabel();
        final JLabel lblcomplemento = new JLabel();
        final JRadioButton jRadioButton1 = new JRadioButton();
        final JLabel lblfidelidade = new JLabel();
        final JRadioButton jRadioButton2 = new JRadioButton();
        final JLabel lblrua = new JLabel();
        final JLabel lblnumfidelidade = new JLabel();
        final JTextField txtnumfidelidade = new JTextField();
        final JLabel lblcelular = new JLabel();
        final JTextField txtcelular = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JLabel lblcep = new JLabel();
        final JLabel lblestado = new JLabel();
        final JLabel lblpais = new JLabel();
        final JLabel lblendereco = new JLabel();
        final JTextField txtrua = new JTextField();
        final JTextField txtbairro = new JTextField();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JTextField txtcep = new JTextField();
        final JTextField txtcpf = new JTextField();
        final JLabel lblcpf = new JLabel();
        final JTextField txttelefone = new JTextField();
        final JTextField txtcidade = new JTextField();
        final JTextField txtemail = new JTextField();
        final JLabel lblemail = new JLabel();
        final JTextField txtpais = new JTextField();
        final JTextField txtnome = new JTextField();
        final JTextField txtestado = new JTextField();
        final JLabel lblnome = new JLabel();
        final JLabel lbltelefone = new JLabel();
        final JButton btnConsultarCliente = new JButton();
        final JButton btnAlterarCliente = new JButton();

        btnConsultarCliente.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    ClienteSerialize dados = new ClienteSerialize();
                    dados = dados.ler(txtcpf.getText().toString());
                     txtnome.setText(dados.getNome());
                     txtemail.setText(dados.geteMail());
                     txttelefone.setText(dados.getTelefone());
                     txtcelular.setText(dados.getCelular());
                     txtnumfidelidade.setText(dados.getNumeroFidelidade());
                     txtrua.setText(dados.getEnd().getRua());
                     txtbairro.setText(dados.getEnd().getBairro());
                     txtnum.setText(dados.getEnd().getNumero());
                     txtcomplemento.setText(dados.getEnd().getComplemento());
                     txtcep.setText(dados.getEnd().getCEP());
                     txtcidade.setText(dados.getEnd().getCidade());
                     txtestado.setText(dados.getEnd().getEstado());
                     txtpais.setText(dados.getEnd().getPais());
                     jRadioButton1.setSelected(dados.isIsFidelidade());
                    
//                    txtnome.setText(sistema.getCliente(txtcpf.getText().toString()).getNome());
//                    txtemail.setText(sistema.getCliente(txtcpf.getText().toString()).geteMail());
//                    txttelefone.setText(sistema.getCliente(txtcpf.getText().toString()).getTelefone());
//                    txtcelular.setText(sistema.getCliente(txtcpf.getText().toString()).getCelular());
//                    txtnumfidelidade.setText(sistema.getCliente(txtcpf.getText().toString()).getNumeroFidelidade());
//                    txtrua.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getRua());
//                    txtbairro.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getBairro());
//                    txtnum.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getNumero());
//                    txtcomplemento.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getComplemento());
//                    txtcep.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCEP());
//                    txtcidade.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCidade());
//                    txtestado.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getEstado());
//                    txtpais.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getPais());
//                    jRadioButton1.setSelected(sistema.getCliente(txtcpf.getText().toString()).getIsClienteFidelidade());
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        });

        btnAlterarCliente.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    //Cadastrando Endereco para cliente - String rua, String bairro, String complemento, String numero, String CEP, String cidade, String estado, String pais
                    Endereco enderecoCliente;

                    enderecoCliente = new Endereco(txtrua.getText().toString(), txtbairro.getText().toString(), txtcomplemento.getText().toString(), txtnum.getText().toString(), txtcep.getText().toString(), txtcidade.getText().toString(), txtestado.getText().toString(), txtpais.getText().toString());

                    ClienteSerialize dados = new ClienteSerialize(txtnome.getText().toString(), txtcpf.getText().toString(), txtemail.getText().toString(), txttelefone.getText().toString(), txtcelular.getText().toString(), jRadioButton1.isSelected(), txtnumfidelidade.getText().toString(), enderecoCliente);
                    dados.alterar(dados);
                    
                    txtnum.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtrua.setText("");
        txtnumfidelidade.setText("");
        txtcelular.setText("");
        txtcidade.setText("");
        txtcep.setText("");
        txtestado.setText("");
        txtpais.setText("");
        txtcpf.setText("");
        txtemail.setText("");
        txtnome.setText("");
        txttelefone.setText("");
                    //Cadastrando Cliente - String nome, String cpf, String eMail, String telefone, String celular, boolean isClienteFidelidade, String numeroFidelidade, Endereco end     
                    //sistema.alterarCliente(txtnome.getText().toString(), txtcpf.getText().toString(), txtemail.getText().toString(), txttelefone.getText().toString(), txtcelular.getText().toString(), jRadioButton1.isSelected(), txtnumfidelidade.getText().toString(), enderecoCliente);
                    
                    
                    JOptionPane.showMessageDialog(null, "Cliente Alterado com Sucesso");
                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, "Entrou no erro");
                }
            }
        });

        lblnum.setText("N°");

        lblbairro.setText("Bairro");

        lblcomplemento.setText("Complemento");

        jRadioButton1.setText("Sim");

        lblfidelidade.setText("Fidelidade");

        jRadioButton2.setText("Não");

        lblrua.setText("Rua");

        lblnumfidelidade.setText("Numero");

        lblcelular.setText("Celular");

        lblcidade.setText("Cidade");

        lblcep.setText("CEP");

        lblestado.setText("Estado");

        lblpais.setText("País");

        lblendereco.setText("Endereço");

        lblcpf.setText("CPF");

        lblemail.setText("Email");

        lblnome.setText("Nome");

        lbltelefone.setText("Telefone");

        btnConsultarCliente.setText("Consultar");

        btnAlterarCliente.setText("Alterar");

        GroupLayout PAlterarClienteLayout = new GroupLayout(PAlterarCliente);
        PAlterarCliente.setLayout(PAlterarClienteLayout);
        PAlterarClienteLayout.setHorizontalGroup(
                PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PAlterarClienteLayout.createSequentialGroup()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblfidelidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton2)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblnumfidelidade)
                .addGap(9, 9, 9))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lbltelefone)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblcelular))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblnome)
                .addGap(18, 18, 18)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(12, 12, 12)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtcelular)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblemail)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtemail, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE))
                .addComponent(txtnumfidelidade)))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblnum)
                .addGap(25, 25, 25)
                .addComponent(txtnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblbairro)
                .addComponent(lblcep, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtbairro)
                .addComponent(txtcep, GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblendereco)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblcpf)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarCliente)))
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtcidade)
                .addGap(18, 18, 18)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblpais)
                .addGap(29, 29, 29)
                .addComponent(txtpais))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnAlterarCliente)))));
        PAlterarClienteLayout.setVerticalGroup(
                PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PAlterarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcpf)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarCliente))
                .addGap(21, 21, 21)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnome)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtemail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblemail)))
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtnumfidelidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnumfidelidade)))
                .addGroup(PAlterarClienteLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcelular)
                .addComponent(txtcelular, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbltelefone))
                .addGap(15, 15, 15)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfidelidade)
                .addComponent(jRadioButton1)
                .addComponent(jRadioButton2))))
                .addGap(18, 18, 18)
                .addComponent(lblendereco)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PAlterarClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(lblestado)
                .addComponent(lblpais)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnAlterarCliente)
                .addGap(41, 41, 41)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(PAlterarCliente, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addComponent(PAlterarCliente, GroupLayout.PREFERRED_SIZE, 290, GroupLayout.PREFERRED_SIZE)
                .addGap(0, 37, Short.MAX_VALUE)));
    }

    public void PainelRemoverCliente() {
        PRemoverCliente = new JPanel();
        final JLabel lblnum = new JLabel();
        final JLabel lblbairro = new JLabel();
        final JLabel lblcomplemento = new JLabel();
        final JRadioButton jRadioButton1 = new JRadioButton();
        final JLabel lblfidelidade = new JLabel();
        final JRadioButton jRadioButton2 = new JRadioButton();
        final JLabel lblrua = new JLabel();
        final JLabel lblnumfidelidade = new JLabel();
        final JTextField txtnumfidelidade = new JTextField();
        final JLabel lblcelular = new JLabel();
        final JTextField txtcelular = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JLabel lblcep = new JLabel();
        final JLabel lblestado = new JLabel();
        final JLabel lblpais = new JLabel();
        final JLabel lblendereco = new JLabel();
        final JTextField txtrua = new JTextField();
        final JTextField txtbairro = new JTextField();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JTextField txtcep = new JTextField();
        final JTextField txtcpf = new JTextField();
        final JLabel lblcpf = new JLabel();
        final JTextField txttelefone = new JTextField();
        final JTextField txtcidade = new JTextField();
        final JTextField txtemail = new JTextField();
        final JLabel lblemail = new JLabel();
        final JTextField txtpais = new JTextField();
        final JTextField txtnome = new JTextField();
        final JTextField txtestado = new JTextField();
        final JLabel lblnome = new JLabel();
        final JLabel lbltelefone = new JLabel();
        JButton btnConsultarCliente = new JButton();
        JButton btnRemoverCliente = new JButton();

        btnConsultarCliente.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    ClienteSerialize dados = new ClienteSerialize();
                    dados = dados.ler(txtcpf.getText().toString());
                     txtnome.setText(dados.getNome());
                     txtemail.setText(dados.geteMail());
                     txttelefone.setText(dados.getTelefone());
                     txtcelular.setText(dados.getCelular());
                     txtnumfidelidade.setText(dados.getNumeroFidelidade());
                     txtrua.setText(dados.getEnd().getRua());
                     txtbairro.setText(dados.getEnd().getBairro());
                     txtnum.setText(dados.getEnd().getNumero());
                     txtcomplemento.setText(dados.getEnd().getComplemento());
                     txtcep.setText(dados.getEnd().getCEP());
                     txtcidade.setText(dados.getEnd().getCidade());
                     txtestado.setText(dados.getEnd().getEstado());
                     txtpais.setText(dados.getEnd().getPais());
                     jRadioButton1.setSelected(dados.isIsFidelidade());
//                    txtnome.setText(sistema.getCliente(txtcpf.getText().toString()).getNome());
//                    txtemail.setText(sistema.getCliente(txtcpf.getText().toString()).geteMail());
//                    txttelefone.setText(sistema.getCliente(txtcpf.getText().toString()).getTelefone());
//                    txtcelular.setText(sistema.getCliente(txtcpf.getText().toString()).getCelular());
//                    txtnumfidelidade.setText(sistema.getCliente(txtcpf.getText().toString()).getNumeroFidelidade());
//                    txtrua.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getRua());
//                    txtbairro.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getBairro());
//                    txtnum.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getNumero());
//                    txtcomplemento.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getComplemento());
//                    txtcep.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCEP());
//                    txtcidade.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getCidade());
//                    txtestado.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getEstado());
//                    txtpais.setText(sistema.getCliente(txtcpf.getText().toString()).getEndereco().getPais());
//                    jRadioButton1.setSelected(sistema.getCliente(txtcpf.getText().toString()).getIsClienteFidelidade());
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        btnRemoverCliente.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try{
                //sistema.removerCliente(txtcpf.getText());
                ClienteSerialize dados = new ClienteSerialize();
                dados.remover(txtcpf.getText());
                JOptionPane.showMessageDialog(null,"Remoção efetuada com sucesso");
                
                txtnum.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtrua.setText("");
        txtnumfidelidade.setText("");
        txtcelular.setText("");
        txtcidade.setText("");
        txtcep.setText("");
        txtestado.setText("");
        txtpais.setText("");
        txtcpf.setText("");
        txtemail.setText("");
        txtnome.setText("");
        txttelefone.setText("");
                }catch(Exception error){
                  JOptionPane.showMessageDialog(null,error.getMessage());
                }
            }
        });

        lblnum.setText("N°");

        lblbairro.setText("Bairro");

        lblcomplemento.setText("Complemento");

        jRadioButton1.setText("Sim");

        lblfidelidade.setText("Fidelidade");

        jRadioButton2.setText("Não");

        lblrua.setText("Rua");

        lblnumfidelidade.setText("Numero");

        lblcelular.setText("Celular");

        lblcidade.setText("Cidade");

        lblcep.setText("CEP");

        lblestado.setText("Estado");

        lblpais.setText("País");

        lblendereco.setText("Endereço");

        lblcpf.setText("CPF");

        lblemail.setText("Email");

        lblnome.setText("Nome");

        lbltelefone.setText("Telefone");

        btnConsultarCliente.setText("Consultar");

        btnRemoverCliente.setText("Remover");

        GroupLayout PRemoverClienteLayout = new GroupLayout(PRemoverCliente);
        PRemoverCliente.setLayout(PRemoverClienteLayout);
        PRemoverClienteLayout.setHorizontalGroup(
                PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PRemoverClienteLayout.createSequentialGroup()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblfidelidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton1)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton2)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblnumfidelidade)
                .addGap(9, 9, 9))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lbltelefone)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblcelular))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblnome)
                .addGap(18, 18, 18)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(12, 12, 12)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtcelular)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblemail)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtemail, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE))
                .addComponent(txtnumfidelidade)))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblnum)
                .addGap(25, 25, 25)
                .addComponent(txtnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblbairro)
                .addComponent(lblcep, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtbairro)
                .addComponent(txtcep, GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblendereco)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblcpf)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarCliente)))
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtcidade)
                .addGap(18, 18, 18)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblpais)
                .addGap(29, 29, 29)
                .addComponent(txtpais))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnRemoverCliente)))));
        PRemoverClienteLayout.setVerticalGroup(
                PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, PRemoverClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcpf)
                .addComponent(txtcpf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarCliente))
                .addGap(21, 21, 21)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnome)
                .addComponent(txtnome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtemail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblemail)))
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtnumfidelidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnumfidelidade)))
                .addGroup(PRemoverClienteLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txttelefone, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcelular)
                .addComponent(txtcelular, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbltelefone))
                .addGap(15, 15, 15)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfidelidade)
                .addComponent(jRadioButton1)
                .addComponent(jRadioButton2))))
                .addGap(18, 18, 18)
                .addComponent(lblendereco)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PRemoverClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(lblestado)
                .addComponent(lblpais)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnRemoverCliente)
                .addGap(41, 41, 41)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(PRemoverCliente, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addComponent(PRemoverCliente, GroupLayout.PREFERRED_SIZE, 290, GroupLayout.PREFERRED_SIZE)
                .addGap(0, 37, Short.MAX_VALUE)));
    }

    public void PainelCadastrarAeronave() throws Exception {
        PCadastrarAeronave = new JPanel();
        final JLabel lblprefixoid = new JLabel();
        final JTextField txtprefixoid = new JTextField();
        final JLabel lblmodelo = new JLabel();
        final JTextField txtmodelo = new JTextField();
        final JLabel lblautonomia = new JLabel();
        final JTextField txtautonomia = new JTextField("0");
        final JLabel lblfileiras = new JLabel();
        final JTextField txtfileiras = new JTextField("0");
        final JLabel lblassentos = new JLabel();
        final JTextField txtassentos = new JTextField("0");
        final JLabel lblexecutivas = new JLabel();
        final JTextField txtexecutivas = new JTextField("0");
        final JLabel lbleconomicas = new JLabel();
        final JTextField txteconomicas = new JTextField("0");
        final JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        final JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        final JButton btnCadastrarAeronave = new JButton();

        btnCadastrarAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //Cadastrando Aeronave - String prefixoIdentificador, String modelo, int autonomia,int numTotalFileiras, int numAssentosPorFileira, int numFileirasExecutiva, int numFileirasEconomica        

                try {
                    sistema.cadastrarAeronave(txtprefixoid.getText().toString(), txtmodelo.getText().toString(), Integer.parseInt(txtautonomia.getText()),
                           Integer.parseInt(txtfileiras.getText().toString()), Integer.parseInt(txtassentos.getText().toString()),
                           Integer.parseInt(txtexecutivas.getText().toString()), Integer.parseInt(txteconomicas.getText().toString()));
                    
                    AeronaveSerialize aeronave = new AeronaveSerialize(txtprefixoid.getText().toString(), txtmodelo.getText().toString(), Integer.parseInt(txtautonomia.getText()),
                            Integer.parseInt(txtfileiras.getText().toString()), Integer.parseInt(txtassentos.getText().toString()),
                            Integer.parseInt(txtexecutivas.getText().toString()), Integer.parseInt(txteconomicas.getText().toString()));
                    aeronave.escrever(aeronave);
                    
                    JOptionPane.showMessageDialog(null, "Aeronave Cadastrada com Sucesso");
                    
                    txtprefixoid.setText("");
        txtmodelo.setText("");
        txtautonomia.setText("");
        txtfileiras.setText("");
        txtassentos.setText("");
        txtexecutivas.setText("");
        txteconomicas.setText("");
        txtdata.setText("");
        txthora.setText("");
        


                } catch (Exception er) {
                    JOptionPane.showMessageDialog(null, er.getMessage());
                }

            }
        });
        lblprefixoid.setText("Prefixo ID");
        lblmodelo.setText("Modelo");
        lblautonomia.setText("Autonomia");
        lblfileiras.setText("Total Fileiras");
        lblassentos.setText("Total Assentos");
        lblexecutivas.setText("Fileiras Executivas");
        lbleconomicas.setText("Fileiras Economicas");
        lbldata.setText("Data Disponível");
        lblhora.setText("Hora Disponível");
        btnCadastrarAeronave.setText("Cadastrar");

        GroupLayout PCadastrarAeronaveLayout = new GroupLayout(PCadastrarAeronave);
        PCadastrarAeronave.setLayout(PCadastrarAeronaveLayout);
        PCadastrarAeronaveLayout.setHorizontalGroup(
                PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(btnCadastrarAeronave)
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addComponent(lblmodelo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtmodelo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addComponent(lblprefixoid)
                .addGap(18, 18, 18)
                .addComponent(txtprefixoid, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addComponent(lblfileiras)
                .addGap(18, 18, 18)
                .addComponent(txtfileiras, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addGap(8, 8, 8)
                .addComponent(lblautonomia)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtautonomia, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addComponent(lblexecutivas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtexecutivas)))))
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addComponent(lblassentos)
                .addGap(18, 18, 18)
                .addComponent(txtassentos, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbleconomicas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txteconomicas, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(326, Short.MAX_VALUE)));
        PCadastrarAeronaveLayout.setVerticalGroup(
                PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarAeronaveLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblprefixoid)
                .addComponent(txtprefixoid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblmodelo)
                .addComponent(txtmodelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblautonomia)
                .addComponent(txtautonomia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileiras)
                .addComponent(txtfileiras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblexecutivas)
                .addComponent(txtexecutivas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addGroup(PCadastrarAeronaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtassentos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbleconomicas)
                .addComponent(txteconomicas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(lblassentos))
                .addGap(113, 113, 113)
                .addComponent(btnCadastrarAeronave)
                .addGap(30, 30, 30)));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarAeronave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addComponent(PCadastrarAeronave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap()));
    }

    public void PainelConsultarAeronave() {
        PConsultarAeronave = new JPanel();
        final JLabel lblprefixoid = new JLabel();
        final JTextField txtprefixoid = new JTextField();
        final JLabel lblmodelo = new JLabel();
        final JTextField txtmodelo = new JTextField();
        final JLabel lblautonomia = new JLabel();
        final JTextField txtautonomia = new JTextField();
        final JLabel lblfileiras = new JLabel();
        final JTextField txtfileiras = new JTextField();
        final JLabel lblassentos = new JLabel();
        final JTextField txtassentos = new JTextField();
        final JLabel lblexecutivas = new JLabel();
        final JTextField txtexecutivas = new JTextField();
        final JLabel lbleconomicas = new JLabel();
        final JTextField txteconomicas = new JTextField();
        final JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        final JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        final JButton btnConsultarAeronave = new JButton();

        btnConsultarAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                      AeronaveSerialize aeronave = new AeronaveSerialize();
                      
                      aeronave = aeronave.ler(txtprefixoid.getText().toString());
                      txtmodelo.setText(aeronave.getModelo().toString());
                      txtautonomia.setText(Integer.toString(aeronave.getAutonomia()));
                      txtfileiras.setText(Integer.toString(aeronave.getNumTotalFileiras()));
                      txtassentos.setText(Integer.toString(aeronave.getNumAssentosPorFileira()));
                      txtexecutivas.setText(Integer.toString(aeronave.getNumFileirasExecutiva()));
                      txteconomicas.setText(Integer.toString(aeronave.getNumFileirasEconomica()));
                      txtdata.setText(aeronave.getDataDisponivel());
                      txthora.setText(aeronave.getHoraDisponivel());
                      
//                    txtprefixoid.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getPrefixoIdentificador());
//                    txtmodelo.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getModelo());
//                    txtautonomia.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getAutonomia()));
//                    txtfileiras.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumTotalFileiras()));
//                    txtassentos.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumAssentosPorFileira()));
//                    txtexecutivas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasExecutiva()));
//                    txteconomicas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasEconomica()));


                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Aeronave inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        lblprefixoid.setText("Prefixo ID");
        lblmodelo.setText("Modelo");
        lblautonomia.setText("Autonomia");
        lblfileiras.setText("Total Fileiras");
        lblassentos.setText("Total Assentos");
        lblexecutivas.setText("Fileiras Executivas");
        lbleconomicas.setText("Fileiras Economicas");
        lbldata.setText("Data Disponível");
        lblhora.setText("Hora Disponível");
        btnConsultarAeronave.setText("Consultar");

        GroupLayout PConsultarAeronaveLayout = new GroupLayout(PConsultarAeronave);
        PConsultarAeronave.setLayout(PConsultarAeronaveLayout);
        PConsultarAeronaveLayout.setHorizontalGroup(
                PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addComponent(lblprefixoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarAeronave))
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addComponent(lblfileiras))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtfileiras, GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                .addComponent(txtassentos))
                .addGap(39, 39, 39)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutivas)
                .addComponent(lbleconomicas))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)))
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addComponent(lblmodelo)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblautonomia)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addGap(18, 18, 18)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addGap(18, 18, 18)
                .addComponent(txthora, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        PConsultarAeronaveLayout.setVerticalGroup(
                PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblprefixoid)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarAeronave))
                .addGap(18, 18, 18)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblmodelo)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblautonomia)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileiras)
                .addComponent(txtfileiras, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblexecutivas)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtassentos, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbleconomicas)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(PConsultarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addContainerGap(55, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelAlterarAeronave() throws Exception {
        PAlterarAeronave = new JPanel();
        final JLabel lblprefixoid = new JLabel();
        final JTextField txtprefixoid = new JTextField("0");
        final JLabel lblmodelo = new JLabel();
        final JTextField txtmodelo = new JTextField();
        final JLabel lblautonomia = new JLabel();
        final JTextField txtautonomia = new JTextField("0");
        final JLabel lblfileiras = new JLabel();
        final JTextField txtfileiras = new JTextField("0");
        final JLabel lblassentos = new JLabel();
        final JTextField txtassentos = new JTextField("0");
        final JLabel lblexecutivas = new JLabel();
        final JTextField txtexecutivas = new JTextField("0");
        final JLabel lbleconomicas = new JLabel();
        final JTextField txteconomicas = new JTextField("0");
        final JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        final JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        final JButton btnConsultarAeronave = new JButton();
        final JButton btnAlterarAeronave = new JButton();

        btnConsultarAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    AeronaveSerialize aeronave = new AeronaveSerialize();
                      
                    aeronave = aeronave.ler(txtprefixoid.getText().toString());
                    txtmodelo.setText(aeronave.getModelo().toString());
                    txtautonomia.setText(Integer.toString(aeronave.getAutonomia()));
                    txtfileiras.setText(Integer.toString(aeronave.getNumTotalFileiras()));
                    txtassentos.setText(Integer.toString(aeronave.getNumAssentosPorFileira()));
                    txtexecutivas.setText(Integer.toString(aeronave.getNumFileirasExecutiva()));
                    txteconomicas.setText(Integer.toString(aeronave.getNumFileirasEconomica()));
                    txtdata.setText(aeronave.getDataDisponivel());
                    txthora.setText(aeronave.getHoraDisponivel());

//                    txtprefixoid.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getPrefixoIdentificador());
//                    txtmodelo.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getModelo());
//                    txtautonomia.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getAutonomia()));
//                    txtfileiras.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumTotalFileiras()));
//                    txtassentos.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumAssentosPorFileira()));
//                    txtexecutivas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasExecutiva()));
//                    txteconomicas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasEconomica()));



                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, "Aeronave inexistente!");
                }

            }
        });

        btnAlterarAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    AeronaveSerialize aeronave = new AeronaveSerialize(txtprefixoid.getText().toString(), txtmodelo.getText().toString(), Integer.parseInt(txtautonomia.getText()),
                            Integer.parseInt(txtfileiras.getText().toString()), Integer.parseInt(txtassentos.getText().toString()),
                            Integer.parseInt(txtexecutivas.getText().toString()), Integer.parseInt(txteconomicas.getText().toString()));
                    aeronave.alterar(aeronave);
                    //Cadastrando Aeronave - String prefixoIdentificador, String modelo, int autonomia,int numTotalFileiras, int numAssentosPorFileira, int numFileirasExecutiva, int numFileirasEconomica        
//                    sistema.alterarAeronave(txtprefixoid.getText().toString(), txtmodelo.getText().toString(), Integer.parseInt(txtautonomia.getText()),
//                            Integer.parseInt(txtfileiras.getText().toString()), Integer.parseInt(txtassentos.getText().toString()),
//                            Integer.parseInt(txtexecutivas.getText().toString()), Integer.parseInt(txteconomicas.getText().toString()));
                    JOptionPane.showMessageDialog(null, "Aeronave Alterada com Sucesso");
                    
                    txtmodelo.setText("");
        txtautonomia.setText("");
        txtfileiras.setText("");
        txtassentos.setText("");
        txtexecutivas.setText("");
        txteconomicas.setText("");
        txtdata.setText("");
        txthora.setText("");
                } catch (Exception er) {
                    JOptionPane.showMessageDialog(null, er.getMessage());
                }

            }
        });

        lblprefixoid.setText("Prefixo ID");
        lblmodelo.setText("Modelo");
        lblautonomia.setText("Autonomia");
        lblfileiras.setText("Total Fileiras");
        lblassentos.setText("Total Assentos");
        lblexecutivas.setText("Fileiras Executivas");
        lbleconomicas.setText("Fileiras Economicas");
        lbldata.setText("Data Disponível");
        lblhora.setText("Hora Disponível");
        btnConsultarAeronave.setText("Consultar");
        btnAlterarAeronave.setText("Alterar");

        GroupLayout PAlterarAeronaveLayout = new GroupLayout(PAlterarAeronave);
        PAlterarAeronave.setLayout(PAlterarAeronaveLayout);
        PAlterarAeronaveLayout.setHorizontalGroup(
                PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addComponent(lblprefixoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarAeronave))
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addComponent(lblfileiras))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtfileiras, GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                .addComponent(txtassentos))
                .addGap(39, 39, 39)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutivas)
                .addComponent(lbleconomicas))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)))
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addComponent(lblmodelo)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblautonomia)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addGap(18, 18, 18)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addGap(18, 18, 18)
                .addComponent(txthora, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(GroupLayout.Alignment.TRAILING, PAlterarAeronaveLayout.createSequentialGroup()
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnAlterarAeronave)
                .addContainerGap()));
        PAlterarAeronaveLayout.setVerticalGroup(
                PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblprefixoid)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarAeronave))
                .addGap(18, 18, 18)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblmodelo)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblautonomia)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileiras)
                .addComponent(txtfileiras, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblexecutivas)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtassentos, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbleconomicas)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(PAlterarAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                .addComponent(btnAlterarAeronave)
                .addContainerGap()));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PAlterarAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PAlterarAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelRemoverAeronave() {
        PRemoverAeronave = new JPanel();
        final JLabel lblprefixoid = new JLabel();
        final JTextField txtprefixoid = new JTextField();
        final JLabel lblmodelo = new JLabel();
        final JTextField txtmodelo = new JTextField();
        final JLabel lblautonomia = new JLabel();
        final JTextField txtautonomia = new JTextField();
        final JLabel lblfileiras = new JLabel();
        final JTextField txtfileiras = new JTextField();
        final JLabel lblassentos = new JLabel();
        final JTextField txtassentos = new JTextField();
        final JLabel lblexecutivas = new JLabel();
        final JTextField txtexecutivas = new JTextField();
        final JLabel lbleconomicas = new JLabel();
        final JTextField txteconomicas = new JTextField();
        final JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        final JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        final JButton btnConsultarAeronave = new JButton();
        final JButton btnRemoverAeronave = new JButton();



        btnRemoverAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    //sistema.removerAeronave(txtprefixoid.getText().toString());
                    AeronaveSerialize aeronave = new AeronaveSerialize();
                    aeronave.remover(txtprefixoid.getText());
                    
                    txtmodelo.setText("");
        txtautonomia.setText("");
        txtfileiras.setText("");
        txtassentos.setText("");
        txtexecutivas.setText("");
        txteconomicas.setText("");
        txtdata.setText("");
        txthora.setText("");
                    
                } catch (NullPointerException error) {
                   JOptionPane.showMessageDialog(null,"Problemas com remoção de outro componente");
                } catch (Exception error2) {
                    JOptionPane.showMessageDialog(null, error2.getMessage());
                }
            }
        });

        btnConsultarAeronave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    AeronaveSerialize aeronave = new AeronaveSerialize();
                      
                      aeronave = aeronave.ler(txtprefixoid.getText().toString());
                      txtmodelo.setText(aeronave.getModelo().toString());
                      txtautonomia.setText(Integer.toString(aeronave.getAutonomia()));
                      txtfileiras.setText(Integer.toString(aeronave.getNumTotalFileiras()));
                      txtassentos.setText(Integer.toString(aeronave.getNumAssentosPorFileira()));
                      txtexecutivas.setText(Integer.toString(aeronave.getNumFileirasExecutiva()));
                      txteconomicas.setText(Integer.toString(aeronave.getNumFileirasEconomica()));
                      txtdata.setText(aeronave.getDataDisponivel());
                      txthora.setText(aeronave.getHoraDisponivel());
                    
//                    txtprefixoid.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getPrefixoIdentificador());
//                    txtmodelo.setText(sistema.getAeronave(txtprefixoid.getText().toString()).getModelo());
//                    txtautonomia.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getAutonomia()));
//                    txtfileiras.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumTotalFileiras()));
//                    txtassentos.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumAssentosPorFileira()));
//                    txtexecutivas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasExecutiva()));
//                    txteconomicas.setText(Integer.toString(sistema.getAeronave(txtprefixoid.getText().toString()).getNumFileirasEconomica()));


                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Aeronave inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        lblprefixoid.setText("Prefixo ID");
        lblmodelo.setText("Modelo");
        lblautonomia.setText("Autonomia");
        lblfileiras.setText("Total Fileiras");
        lblassentos.setText("Total Assentos");
        lblexecutivas.setText("Fileiras Executivas");
        lbleconomicas.setText("Fileiras Economicas");
        lbldata.setText("Data Disponível");
        lblhora.setText("Hora Disponível");
        btnConsultarAeronave.setText("Consultar");
        btnRemoverAeronave.setText("Remover");

        GroupLayout PRemoverAeronaveLayout = new GroupLayout(PRemoverAeronave);
        PRemoverAeronave.setLayout(PRemoverAeronaveLayout);
        PRemoverAeronaveLayout.setHorizontalGroup(
                PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addComponent(lblprefixoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarAeronave))
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addComponent(lblfileiras))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txtfileiras, GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                .addComponent(txtassentos))
                .addGap(39, 39, 39)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutivas)
                .addComponent(lbleconomicas))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)))
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addComponent(lblmodelo)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblautonomia)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addGap(18, 18, 18)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addGap(18, 18, 18)
                .addComponent(txthora, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(GroupLayout.Alignment.TRAILING, PRemoverAeronaveLayout.createSequentialGroup()
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnRemoverAeronave)
                .addContainerGap()));
        PRemoverAeronaveLayout.setVerticalGroup(
                PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverAeronaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblprefixoid)
                .addComponent(txtprefixoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarAeronave))
                .addGap(18, 18, 18)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblmodelo)
                .addComponent(txtmodelo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblautonomia)
                .addComponent(txtautonomia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileiras)
                .addComponent(txtfileiras, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblexecutivas)
                .addComponent(txtexecutivas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblassentos)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtassentos, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbleconomicas)
                .addComponent(txteconomicas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(PRemoverAeronaveLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                .addComponent(btnRemoverAeronave)
                .addContainerGap()));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverAeronave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelCadastrarDestino() throws Exception {
        PCadastrarDestino = new JPanel();
        final JLabel lblcodigoid = new JLabel();
        final JTextField txtcodigoid = new JTextField("0");
        final JLabel lblcidadedest = new JLabel();
        final JTextField txtcidadedest = new JTextField();
        final JLabel lblnomeaeroporto = new JLabel();
        final JTextField txtnomeaeroporto = new JTextField();
        final JLabel lblfuso = new JLabel();
        final JTextField txtfuso = new JTextField("0");
        final JLabel lbldistancia = new JLabel();
        final JTextField txtdistancia = new JTextField("0");
        final JLabel lblendereco = new JLabel();
        final JLabel lblrua = new JLabel();
        final JTextField txtrua = new JTextField();
        final JLabel lblbairro = new JLabel();
        final JTextField txtbairro = new JTextField();
        final JLabel lblcomplemento = new JLabel();
        final JLabel lblnum = new JLabel();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JLabel lblcep = new JLabel();
        final JTextField txtcep = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JTextField txtcidade = new JTextField();
        final JLabel lblestado = new JLabel();
        final JTextField txtestado = new JTextField();
        final JLabel lblpais = new JLabel();
        final JTextField txtpais = new JTextField();
        final JButton btnCadastrarDestino = new JButton();

        btnCadastrarDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    Endereco enderecoDestino = new Endereco(txtrua.getText().toString(), txtbairro.getText().toString(), txtcomplemento.getText().toString(),
                            txtnum.getText().toString(), txtcep.getText().toString(), txtcidade.getText().toString(),
                            txtestado.getText().toString(), txtpais.getText().toString());

                    //Cadastrando Destino - int cod,String Cidade, String Aeroporto,int Fuso, double Distancia, Endereco end
                    sistema.cadastrarDestino(Integer.parseInt(txtcodigoid.getText()), txtcidadedest.getText().toString(), txtnomeaeroporto.getText().toString(), Integer.parseInt(txtfuso.getText()), Double.parseDouble(txtdistancia.getText()), enderecoDestino);
                    DestinoSerialize dados = new DestinoSerialize(Integer.parseInt(txtcodigoid.getText()), txtcidadedest.getText().toString(), txtnomeaeroporto.getText().toString(), Integer.parseInt(txtfuso.getText()), Double.parseDouble(txtdistancia.getText()), enderecoDestino);
                    dados.escrever(dados);
                    JOptionPane.showMessageDialog(null, "Destino Cadastrada com Sucesso");
                    
                    txtcodigoid.setText("");
        txtcidadedest.setText("");
        txtnomeaeroporto.setText("");
        txtfuso.setText("");
        txtdistancia.setText("");
        txtrua.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtnum.setText("");
        txtcep.setText("");
        txtcidade.setText("");
        txtestado.setText("");
        txtpais.setText("");
        
                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, err.getMessage());               
                }
            }
        });


        lblcodigoid.setText("Código");
        lblcidadedest.setText("Cidade Destino");
        lblnomeaeroporto.setText("Nome Aeroporto");
        lblfuso.setText("Fuso");
        lbldistancia.setText("Distância");
        lblendereco.setText("Endereço");
        lblrua.setText("Rua");
        lblbairro.setText("Bairro");
        lblcomplemento.setText("Complemento");
        lblnum.setText("N°");
        lblcep.setText("CEP");
        lblcidade.setText("Cidade");
        lblestado.setText("Estado");
        lblpais.setText("País");
        btnCadastrarDestino.setText("Cadastrar");

        GroupLayout PCadastrarDestinoLayout = new GroupLayout(PCadastrarDestino);
        PCadastrarDestino.setLayout(PCadastrarDestinoLayout);
        PCadastrarDestinoLayout.setHorizontalGroup(
                PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblpais)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtpais))
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblcodigoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidadedest)
                .addGap(18, 18, 18)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblnomeaeroporto)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnomeaeroporto)))
                .addGap(28, 28, 28)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblfuso)
                .addGap(18, 18, 18)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lbldistancia)
                .addGap(18, 18, 18)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
                .addComponent(lblendereco)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblbairro)
                .addGap(18, 18, 18)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblcep)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 17, Short.MAX_VALUE))
                .addGroup(GroupLayout.Alignment.TRAILING, PCadastrarDestinoLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnCadastrarDestino)))
                .addContainerGap()));
        PCadastrarDestinoLayout.setVerticalGroup(
                PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarDestinoLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodigoid)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidadedest)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblfuso)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomeaeroporto)
                .addComponent(txtnomeaeroporto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldistancia)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addComponent(lblendereco)
                .addGap(18, 18, 18)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblestado)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblpais)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
                .addComponent(btnCadastrarDestino)
                .addContainerGap()));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PCadastrarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelConsultarDestino() throws Exception {
        PConsultarDestino = new JPanel();
        final JLabel lblcodigoid = new JLabel("0");
        final JTextField txtcodigoid = new JTextField();
        final JLabel lblcidadedest = new JLabel();
        final JTextField txtcidadedest = new JTextField();
        final JLabel lblnomeaeroporto = new JLabel();
        final JTextField txtnomeaeroporto = new JTextField();
        final JLabel lblfuso = new JLabel();
        final JTextField txtfuso = new JTextField();
        final JLabel lbldistancia = new JLabel();
        final JTextField txtdistancia = new JTextField();
        final JLabel lblendereco = new JLabel();
        final JLabel lblrua = new JLabel();
        final JTextField txtrua = new JTextField();
        final JLabel lblbairro = new JLabel();
        final JTextField txtbairro = new JTextField();
        final JLabel lblcomplemento = new JLabel();
        final JLabel lblnum = new JLabel();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JLabel lblcep = new JLabel();
        final JTextField txtcep = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JTextField txtcidade = new JTextField();
        final JLabel lblestado = new JLabel();
        final JTextField txtestado = new JTextField();
        final JLabel lblpais = new JLabel();
        final JTextField txtpais = new JTextField();
        final JButton btnConsultarDestino = new JButton();

        btnConsultarDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    DestinoSerialize dados = new DestinoSerialize();
                    dados = dados.ler(txtcodigoid.getText().toString());
                    
                    txtcodigoid.setText(Integer.toString(dados.getcodigoIdentificador()));
                    txtcidadedest.setText(dados.getNomeCidade());
                    txtnomeaeroporto.setText(dados.getNomeAeroporto());
                    txtfuso.setText(Integer.toString(dados.getFusoHorario()));
                    txtdistancia.setText(String.valueOf(dados.getDistanciaBase()));
                    txtrua.setText(dados.getEnderecoAeroporto().getRua());
                    txtbairro.setText(dados.getEnderecoAeroporto().getBairro());
                    txtcomplemento.setText(dados.getEnderecoAeroporto().getComplemento());
                    txtnum.setText(dados.getEnderecoAeroporto().getNumero());
                    txtcep.setText(dados.getEnderecoAeroporto().getCEP());
                    txtcidade.setText(dados.getEnderecoAeroporto().getCidade());
                    txtestado.setText(dados.getEnderecoAeroporto().getEstado());
                    txtpais.setText(dados.getEnderecoAeroporto().getPais());



                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, err.getMessage());
                }
            }
        });

        lblcodigoid.setText("Código");

        lblcidadedest.setText("Cidade Destino");

        lblnomeaeroporto.setText("Nome Aeroporto");

        lblfuso.setText("Fuso");

        lbldistancia.setText("Distância");

        lblendereco.setText("Endereço");

        lblrua.setText("Rua");

        lblbairro.setText("Bairro");

        lblcomplemento.setText("Complemento");

        lblnum.setText("N°");

        lblcep.setText("CEP");

        lblcidade.setText("Cidade");

        lblestado.setText("Estado");

        lblpais.setText("País");

        btnConsultarDestino.setText("Consultar");

        GroupLayout PConsultarDestinoLayout = new GroupLayout(PConsultarDestino);
        PConsultarDestino.setLayout(PConsultarDestinoLayout);
        PConsultarDestinoLayout.setHorizontalGroup(
                PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblpais)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtpais))
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidadedest)
                .addGap(18, 18, 18)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblnomeaeroporto)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnomeaeroporto)))
                .addGap(28, 28, 28)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblfuso)
                .addGap(18, 18, 18)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lbldistancia)
                .addGap(18, 18, 18)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
                .addComponent(lblendereco)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblbairro)
                .addGap(18, 18, 18)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblcep)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addComponent(lblcodigoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarDestino)))
                .addGap(0, 17, Short.MAX_VALUE)))
                .addContainerGap()));
        PConsultarDestinoLayout.setVerticalGroup(
                PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarDestinoLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodigoid)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGroup(GroupLayout.Alignment.TRAILING, PConsultarDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnConsultarDestino)))
                .addGap(18, 18, 18)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidadedest)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblfuso)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomeaeroporto)
                .addComponent(txtnomeaeroporto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldistancia)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addComponent(lblendereco)
                .addGap(18, 18, 18)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PConsultarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblestado)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblpais)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addContainerGap(45, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PConsultarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelAlterarDestino() throws Exception {
        PAlterarDestino = new JPanel();
        final JLabel lblcodigoid = new JLabel();
        final JTextField txtcodigoid = new JTextField();
        final JLabel lblcidadedest = new JLabel();
        final JTextField txtcidadedest = new JTextField();
        final JLabel lblnomeaeroporto = new JLabel();
        final JTextField txtnomeaeroporto = new JTextField();
        final JLabel lblfuso = new JLabel();
        final JTextField txtfuso = new JTextField();
        final JLabel lbldistancia = new JLabel();
        final JTextField txtdistancia = new JTextField();
        final JLabel lblendereco = new JLabel();
        final JLabel lblrua = new JLabel();
        final JTextField txtrua = new JTextField();
        final JLabel lblbairro = new JLabel();
        final JTextField txtbairro = new JTextField();
        final JLabel lblcomplemento = new JLabel();
        final JLabel lblnum = new JLabel();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JLabel lblcep = new JLabel();
        final JTextField txtcep = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JTextField txtcidade = new JTextField();
        final JLabel lblestado = new JLabel();
        final JTextField txtestado = new JTextField();
        final JLabel lblpais = new JLabel();
        final JTextField txtpais = new JTextField();
        final JButton btnConsultarDestino = new JButton();
        final JButton btnAlterarDestino = new JButton();

        lblcodigoid.setText("Código");
        lblcidadedest.setText("Cidade Destino");
        lblnomeaeroporto.setText("Nome Aeroporto");
        lblfuso.setText("Fuso");
        lbldistancia.setText("Distância");
        lblendereco.setText("Endereço");
        lblrua.setText("Rua");
        lblbairro.setText("Bairro");
        lblcomplemento.setText("Complemento");
        lblnum.setText("N°");
        lblcep.setText("CEP");
        lblcidade.setText("Cidade");
        lblestado.setText("Estado");
        lblpais.setText("País");
        btnConsultarDestino.setText("Consultar");
        btnAlterarDestino.setText("Alterar");

        btnConsultarDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    DestinoSerialize dados = new DestinoSerialize();
                    
                    dados = dados.ler(txtcodigoid.getText().toString());
                    
                    txtcodigoid.setText(Integer.toString(dados.getcodigoIdentificador()));
                    txtcidadedest.setText(dados.getNomeCidade());
                    txtnomeaeroporto.setText(dados.getNomeAeroporto());
                    txtfuso.setText(Integer.toString(dados.getFusoHorario()));
                    txtdistancia.setText(String.valueOf(dados.getDistanciaBase()));
                    txtrua.setText(dados.getEnderecoAeroporto().getRua());
                    txtbairro.setText(dados.getEnderecoAeroporto().getBairro());
                    txtcomplemento.setText(dados.getEnderecoAeroporto().getComplemento());
                    txtnum.setText(dados.getEnderecoAeroporto().getNumero());
                    txtcep.setText(dados.getEnderecoAeroporto().getCEP());
                    txtcidade.setText(dados.getEnderecoAeroporto().getCidade());
                    txtestado.setText(dados.getEnderecoAeroporto().getEstado());
                    txtpais.setText(dados.getEnderecoAeroporto().getPais());

                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, "Destino inexistente! Digite novamente.");
                }
            }
        });

        btnAlterarDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    //Cadastrando Endereco para destino - String rua, String bairro, String complemento, String numero, String CEP, String cidade, String estado, String pais
                    Endereco enderecoDestino;

                    enderecoDestino = new Endereco(txtrua.getText().toString(), txtbairro.getText().toString(), txtcomplemento.getText().toString(), txtnum.getText().toString(), txtcep.getText().toString(), txtcidade.getText().toString(), txtestado.getText().toString(), txtpais.getText().toString());

                    DestinoSerialize dados = new DestinoSerialize(Integer.parseInt(txtcodigoid.getText()), txtcidadedest.getText().toString(), txtnomeaeroporto.getText().toString(), Integer.parseInt(txtfuso.getText()), Double.parseDouble(txtdistancia.getText()), enderecoDestino);
                    JOptionPane.showMessageDialog(null, dados.getcodigoIdentificador());
                    dados.alterar(dados);
                    
                    txtcodigoid.setText("");
        txtcidadedest.setText("");
        txtnomeaeroporto.setText("");
        txtfuso.setText("");
        txtdistancia.setText("");
        txtrua.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtnum.setText("");
        txtcep.setText("");
        txtcidade.setText("");
        txtestado.setText("");
        txtpais.setText("");
                    //Cadastrando Cliente - String nome, String cpf, String eMail, String telefone, String celular, boolean isClienteFidelidade, String numeroFidelidade, Endereco end     
                    //sistema.alterarDestino(Integer.parseInt(txtcodigoid.getText()), txtcidadedest.getText().toString(), txtnomeaeroporto.getText().toString(),
                      //      Integer.parseInt(txtfuso.getText()), Double.parseDouble(txtdistancia.getText()), enderecoDestino);
                    JOptionPane.showMessageDialog(null, "Destino Alterado com Sucesso!");
                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, err.getMessage());
                }
            }
        });

        GroupLayout PAlterarDestinoLayout = new GroupLayout(PAlterarDestino);
        PAlterarDestino.setLayout(PAlterarDestinoLayout);
        PAlterarDestinoLayout.setHorizontalGroup(
                PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidadedest)
                .addGap(18, 18, 18)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblnomeaeroporto)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnomeaeroporto)))
                .addGap(28, 28, 28)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblfuso)
                .addGap(18, 18, 18)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lbldistancia)
                .addGap(18, 18, 18)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
                .addComponent(lblendereco)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblbairro)
                .addGap(18, 18, 18)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblcep)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblcodigoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarDestino)))
                .addGap(0, 17, Short.MAX_VALUE))
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblpais)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtpais))
                .addGroup(GroupLayout.Alignment.TRAILING, PAlterarDestinoLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnAlterarDestino)))
                .addContainerGap()));
        PAlterarDestinoLayout.setVerticalGroup(
                PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarDestinoLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodigoid)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGroup(GroupLayout.Alignment.TRAILING, PAlterarDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnConsultarDestino)))
                .addGap(18, 18, 18)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidadedest)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblfuso)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomeaeroporto)
                .addComponent(txtnomeaeroporto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldistancia)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addComponent(lblendereco)
                .addGap(18, 18, 18)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PAlterarDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblestado)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblpais)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAlterarDestino)
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PAlterarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PAlterarDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelRemoverDestino() {
        PRemoverDestino = new JPanel();
        final JLabel lblcodigoid = new JLabel();
        final JTextField txtcodigoid = new JTextField();
        final JLabel lblcidadedest = new JLabel();
        final JTextField txtcidadedest = new JTextField();
        final JLabel lblnomeaeroporto = new JLabel();
        final JTextField txtnomeaeroporto = new JTextField();
        final JLabel lblfuso = new JLabel();
        final JTextField txtfuso = new JTextField();
        final JLabel lbldistancia = new JLabel();
        final JTextField txtdistancia = new JTextField();
        final JLabel lblendereco = new JLabel();
        final JLabel lblrua = new JLabel();
        final JTextField txtrua = new JTextField();
        final JLabel lblbairro = new JLabel();
        final JTextField txtbairro = new JTextField();
        final JLabel lblcomplemento = new JLabel();
        final JLabel lblnum = new JLabel();
        final JTextField txtnum = new JTextField();
        final JTextField txtcomplemento = new JTextField();
        final JLabel lblcep = new JLabel();
        final JTextField txtcep = new JTextField();
        final JLabel lblcidade = new JLabel();
        final JTextField txtcidade = new JTextField();
        final JLabel lblestado = new JLabel();
        final JTextField txtestado = new JTextField();
        final JLabel lblpais = new JLabel();
        final JTextField txtpais = new JTextField();
        final JButton btnConsultarDestino = new JButton();
        final JButton btnRemoverDestino = new JButton();

        btnConsultarDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    DestinoSerialize dados = new DestinoSerialize();
                    dados = dados.ler(txtcodigoid.getText().toString());
                    
                    txtcodigoid.setText(Integer.toString(dados.getcodigoIdentificador()));
                    txtcidadedest.setText(dados.getNomeCidade());
                    txtnomeaeroporto.setText(dados.getNomeAeroporto());
                    txtfuso.setText(Integer.toString(dados.getFusoHorario()));
                    txtdistancia.setText(String.valueOf(dados.getDistanciaBase()));
                    txtrua.setText(dados.getEnderecoAeroporto().getRua());
                    txtbairro.setText(dados.getEnderecoAeroporto().getBairro());
                    txtcomplemento.setText(dados.getEnderecoAeroporto().getComplemento());
                    txtnum.setText(dados.getEnderecoAeroporto().getNumero());
                    txtcep.setText(dados.getEnderecoAeroporto().getCEP());
                    txtcidade.setText(dados.getEnderecoAeroporto().getCidade());
                    txtestado.setText(dados.getEnderecoAeroporto().getEstado());
                    txtpais.setText(dados.getEnderecoAeroporto().getPais());

                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Destino inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        btnRemoverDestino.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try{
                    DestinoSerialize dados = new DestinoSerialize();
                    dados.remover(txtcodigoid.getText());
               
                  //sistema.removerDestino(Integer.parseInt(txtcodigoid.getText()));
                  JOptionPane.showMessageDialog(null,"Remoção efetuada com sucesso");
                  
                  txtcodigoid.setText("");
        txtcidadedest.setText("");
        txtnomeaeroporto.setText("");
        txtfuso.setText("");
        txtdistancia.setText("");
        txtrua.setText("");
        txtbairro.setText("");
        txtcomplemento.setText("");
        txtnum.setText("");
        txtcep.setText("");
        txtcidade.setText("");
        txtestado.setText("");
        txtpais.setText("");
                }catch(Exception error){
                   JOptionPane.showMessageDialog(null,error.getMessage()); 
                }
                
            }
        });

        lblcodigoid.setText("Código");
        lblcidadedest.setText("Cidade Destino");
        lblnomeaeroporto.setText("Nome Aeroporto");
        lblfuso.setText("Fuso");
        lbldistancia.setText("Distância");
        lblendereco.setText("Endereço");
        lblrua.setText("Rua");
        lblbairro.setText("Bairro");
        lblcomplemento.setText("Complemento");
        lblnum.setText("N°");
        lblcep.setText("CEP");
        lblcidade.setText("Cidade");
        lblestado.setText("Estado");
        lblpais.setText("País");
        btnConsultarDestino.setText("Consultar");
        btnRemoverDestino.setText("Remover");

        GroupLayout PRemoverDestinoLayout = new GroupLayout(PRemoverDestino);
        PRemoverDestino.setLayout(PRemoverDestinoLayout);
        PRemoverDestinoLayout.setHorizontalGroup(
                PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblcidadedest)
                .addGap(18, 18, 18)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblnomeaeroporto)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnomeaeroporto)))
                .addGap(28, 28, 28)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblfuso)
                .addGap(18, 18, 18)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lbldistancia)
                .addGap(18, 18, 18)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
                .addComponent(lblendereco)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblrua)
                .addGap(18, 18, 18)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblbairro)
                .addGap(18, 18, 18)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblnum)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblcomplemento)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblcep)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblcodigoid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarDestino)))
                .addGap(0, 17, Short.MAX_VALUE))
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addComponent(lblcidade)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblestado)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblpais)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtpais))
                .addGroup(GroupLayout.Alignment.TRAILING, PRemoverDestinoLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnRemoverDestino)))
                .addContainerGap()));
        PRemoverDestinoLayout.setVerticalGroup(
                PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverDestinoLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodigoid)
                .addComponent(txtcodigoid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addGroup(GroupLayout.Alignment.TRAILING, PRemoverDestinoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnConsultarDestino)))
                .addGap(18, 18, 18)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidadedest)
                .addComponent(txtcidadedest, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblfuso)
                .addComponent(txtfuso, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomeaeroporto)
                .addComponent(txtnomeaeroporto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldistancia)
                .addComponent(txtdistancia, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addComponent(lblendereco)
                .addGap(18, 18, 18)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblrua)
                .addComponent(txtrua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblbairro)
                .addComponent(txtbairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblnum)
                .addComponent(txtnum, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcomplemento)
                .addComponent(txtcomplemento, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblcep)
                .addComponent(txtcep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PRemoverDestinoLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcidade)
                .addComponent(txtcidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblestado)
                .addComponent(txtestado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblpais)
                .addComponent(txtpais, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnRemoverDestino)
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PRemoverDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverDestino, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelCadastrarVoo() {
        PCadastrarVoo = new JPanel();
        JLabel lblcodid = new JLabel();
        final JTextField txtcodid = new JTextField();
        JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        JLabel lbleconomica = new JLabel();
        final JTextField txteconomica = new JTextField();
        JLabel lblexecutiva = new JLabel();
        final JTextField txtexecutiva = new JTextField();
        JLabel lbldestino = new JLabel();
        final JTextField txtdestino = new JTextField();
        JButton btnCadastrarVoo = new JButton();

        btnCadastrarVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    DestinoSerialize destino = new DestinoSerialize();
                    destino = destino.ler(txtdestino.getText());
                        
                    //Cadastrando Voo - int Vcod, String Vdata, String Vhora, double VPEc, double VPEx, Destino destino
                    //sistema.cadastrarVoo(Integer.parseInt(txtcodid.getText()), txtdata.getText(), txthora.getText(), Double.parseDouble(txteconomica.getText()), Double.parseDouble(txtexecutiva.getText()), Integer.parseInt(txtdestino.getText()));
                    VooSerialize dados = new VooSerialize(Integer.parseInt(txtcodid.getText()), txtdata.getText(), txthora.getText(), Double.parseDouble(txteconomica.getText()), Double.parseDouble(txtexecutiva.getText()), destino);
                    dados.escrever(dados);
                    
                    JOptionPane.showMessageDialog(null, "Voo Cadastrado com Sucesso !");
                    
                    txtcodid.setText("");
//        //txtdata.setText("");
//        txthora.setText("");
//        txteconomica.setText("");
//        txtexecutiva.setText("");
//        txtdestino.setText("");
                } catch (Exception err) {
                    JOptionPane.showMessageDialog(null, err.getMessage());
                    
                }

            }
        });

        lblcodid.setText("Código");
        lbldata.setText("Data");
        lblhora.setText("Hora");
        lbleconomica.setText("Passagem Economica");
        lblexecutiva.setText("Passagem Executiva");
        lbldestino.setText("Código Destino");

        btnCadastrarVoo.setText("Cadastrar");

        GroupLayout PCadastrarVooLayout = new GroupLayout(PCadastrarVoo);
        PCadastrarVoo.setLayout(PCadastrarVooLayout);
        PCadastrarVooLayout.setHorizontalGroup(
                PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarVooLayout.createSequentialGroup()
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addGroup(PCadastrarVooLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addComponent(lblexecutiva)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtexecutiva, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PCadastrarVooLayout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(lbleconomica)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txteconomica, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(PCadastrarVooLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarVooLayout.createSequentialGroup()
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblcodid)
                .addComponent(lbldata))
                .addGap(34, 34, 34)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(txtcodid, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtdata, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addComponent(lblhora)
                .addGap(18, 18, 18)
                .addComponent(txthora, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PCadastrarVooLayout.createSequentialGroup()
                .addComponent(lbldestino)
                .addGap(18, 18, 18)
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(154, 154, 154))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PCadastrarVooLayout.createSequentialGroup()
                .addComponent(btnCadastrarVoo)
                .addGap(25, 25, 25)))));
        PCadastrarVooLayout.setVerticalGroup(
                PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarVooLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodid)
                .addComponent(txtcodid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txteconomica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbleconomica))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(txtexecutiva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblexecutiva, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarVooLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldestino))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE)
                .addComponent(btnCadastrarVoo)
                .addGap(22, 22, 22)));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarVoo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarVoo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    }

    public void PainelConsultarVoo() {
        PConsultarVoo = new JPanel();
        JLabel lblcodid = new JLabel();
        final JTextField txtcodid = new JTextField();
        JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        JLabel lbleconomica = new JLabel();
        final JTextField txteconomica = new JTextField();
        JLabel lblexecutiva = new JLabel();
        final JTextField txtexecutiva = new JTextField();
        JLabel lbldestino = new JLabel();
        final JTextField txtdestino = new JTextField();
        JButton btnConsultarVoo = new JButton();
        btnConsultarVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    VooSerialize dados = new VooSerialize();
                    dados = dados.ler(txtcodid.getText());
                    
                    //int codigo = Integer.parseInt(txtcodid.getText());
                    txtdata.setText(dados.getData());
                    txthora.setText(dados.getHora());
                    txteconomica.setText(dados.getValorPassagemEconomica()+ "");
                    txtexecutiva.setText(dados.getValorPassagemExecutiva()+"");
                    txtdestino.setText(Integer.toString(dados.getDestinoVoo().getcodigoIdentificador()));
                    

                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Voo inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        lblcodid.setText("Código");
        lbldata.setText("Data");
        lblhora.setText("Hora");
        lbleconomica.setText("Passagem Economica");
        lblexecutiva.setText("Passagem Executiva");
        lbldestino.setText("Código Destino");
        btnConsultarVoo.setText("Consultar");

        GroupLayout PConsultarVooLayout = new GroupLayout(PConsultarVoo);
        PConsultarVoo.setLayout(PConsultarVooLayout);
        PConsultarVooLayout.setHorizontalGroup(
                PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarVooLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarVooLayout.createSequentialGroup()
                .addComponent(lblcodid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarVoo))
                .addGroup(PConsultarVooLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarVooLayout.createSequentialGroup()
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lbleconomica)
                .addComponent(lblexecutiva)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                .addComponent(txtexecutiva)
                .addComponent(txteconomica)
                .addComponent(txtdestino, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))))
                .addContainerGap(106, Short.MAX_VALUE)));
        PConsultarVooLayout.setVerticalGroup(
                PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarVooLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodid)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarVoo))
                .addGap(24, 24, 24)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbleconomica)
                .addComponent(txteconomica, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutiva)
                .addComponent(txtexecutiva, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PConsultarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtdestino, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldestino))
                .addContainerGap(81, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelAlterarVoo() {
        PAlterarVoo = new JPanel();
        JLabel lblcodid = new JLabel();
        final JTextField txtcodid = new JTextField();
        JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        JLabel lbleconomica = new JLabel();
        final JTextField txteconomica = new JTextField();
        JLabel lblexecutiva = new JLabel();
        final JTextField txtexecutiva = new JTextField();
        JLabel lbldestino = new JLabel();
        final JTextField txtdestino = new JTextField();
        JButton btnConsultarVoo = new JButton();
        JButton btnAlterarVoo = new JButton();
        btnConsultarVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    VooSerialize dados = new VooSerialize();
                    dados = dados.ler(txtcodid.getText().toString());
                    
                    //int codigo = Integer.parseInt(txtcodid.getText());
                    txtdata.setText(dados.getData());
                    txthora.setText(dados.getHora());
                    txteconomica.setText(dados.getValorPassagemEconomica()+ "");
                    txtexecutiva.setText(dados.getValorPassagemExecutiva()+"");
                    txtdestino.setText(Integer.toString(dados.getDestinoVoo().getcodigoIdentificador()));
                    
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        btnAlterarVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //Cadastrando Voo - int Vcod, String Vdata, String Vhora, double VPEc, double VPEx, Destino destino
                try {
                    DestinoSerialize destino = new DestinoSerialize();
                    destino = destino.ler(txtdestino.getText());
                    
                    VooSerialize dados = new VooSerialize(Integer.parseInt(txtcodid.getText()), txtdata.getText(), txthora.getText(), Double.parseDouble(txteconomica.getText()), Double.parseDouble(txtexecutiva.getText()), destino);
 
                    
                    dados.alterar(dados);
                    //sistema.alterarVoo(Integer.parseInt(txtcodid.getText()), txtdata.getText(), txthora.getText(), Double.parseDouble(txteconomica.getText()), Double.parseDouble(txtexecutiva.getText()), sistema.getDestino(Integer.parseInt(txtdestino.getText())));
                    JOptionPane.showMessageDialog(null, "Voo alterado com sucesso");
                    
                    txtcodid.setText("");
        txtdata.setText("");
        txthora.setText("");
        txteconomica.setText("");
        txtexecutiva.setText("");
        txtdestino.setText("");
                } catch (NullPointerException error1) {
                    JOptionPane.showMessageDialog(null, "Voo inexistente!");
                } catch (Exception error2) {
                    JOptionPane.showMessageDialog(null, error2.getMessage());
                }

            }
        });

        lblcodid.setText("Código");
        lbldata.setText("Data");
        lblhora.setText("Hora");
        lbleconomica.setText("Passagem Economica");
        lblexecutiva.setText("Passagem Executiva");
        lbldestino.setText("Código Destino");
        btnConsultarVoo.setText("Consultar");
        btnAlterarVoo.setText("Alterar");

        GroupLayout PAlterarVooLayout = new GroupLayout(PAlterarVoo);
        PAlterarVoo.setLayout(PAlterarVooLayout);
        PAlterarVooLayout.setHorizontalGroup(
                PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarVooLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(btnAlterarVoo)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarVooLayout.createSequentialGroup()
                .addComponent(lblcodid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarVoo))
                .addGroup(PAlterarVooLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PAlterarVooLayout.createSequentialGroup()
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lbleconomica)
                .addComponent(lblexecutiva)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                .addComponent(txtexecutiva)
                .addComponent(txteconomica)
                .addComponent(txtdestino, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)))))
                .addContainerGap(106, Short.MAX_VALUE)));
        PAlterarVooLayout.setVerticalGroup(
                PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PAlterarVooLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodid)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarVoo))
                .addGap(24, 24, 24)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbleconomica)
                .addComponent(txteconomica, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutiva)
                .addComponent(txtexecutiva, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PAlterarVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtdestino, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addComponent(btnAlterarVoo)
                .addContainerGap(40, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PAlterarVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PAlterarVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    }

    public void PainelRemoverVoo() {
        PRemoverVoo = new JPanel();
        JLabel lblcodid = new JLabel();
        final JTextField txtcodid = new JTextField();
        JLabel lbldata = new JLabel();
        final JTextField txtdata = new JTextField();
        JLabel lblhora = new JLabel();
        final JTextField txthora = new JTextField();
        JLabel lbleconomica = new JLabel();
        final JTextField txteconomica = new JTextField();
        JLabel lblexecutiva = new JLabel();
        final JTextField txtexecutiva = new JTextField();
        JLabel lbldestino = new JLabel();
        final JTextField txtdestino = new JTextField();
        JButton btnConsultarVoo = new JButton();
        JButton btnRemoverVoo = new JButton();
        btnConsultarVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    VooSerialize dados = new VooSerialize();
                    dados = dados.ler(txtcodid.getText().toString());
                    
                    //int codigo = Integer.parseInt(txtcodid.getText());
                    txtdata.setText(dados.getData());
                    txthora.setText(dados.getHora());
                    txteconomica.setText(dados.getValorPassagemEconomica()+ "");
                    txtexecutiva.setText(dados.getValorPassagemExecutiva()+"");
                    txtdestino.setText(Integer.toString(dados.getDestinoVoo().getcodigoIdentificador()));
                    
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Voo inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        btnRemoverVoo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    VooSerialize dados = new VooSerialize();
                    dados.remover(txtcodid.getText());
                    
                    //sistema.removerVoo(Integer.parseInt(txtcodid.getText()));
                    JOptionPane.showMessageDialog(null, "Reserva removida com sucesso");
                    
                    txtcodid.setText("");
        txtdata.setText("");
        txthora.setText("");
        txteconomica.setText("");
        txtexecutiva.setText("");
        txtdestino.setText("");
                } catch (Exception error) {
                    JOptionPane.showMessageDialog(null, error.getMessage());
                }
            }
        });

        lblcodid.setText("Código");
        lbldata.setText("Data");
        lblhora.setText("Hora");
        lbleconomica.setText("Passagem Economica");
        lblexecutiva.setText("Passagem Executiva");
        lbldestino.setText("Código Destino");
        btnConsultarVoo.setText("Consultar");
        btnRemoverVoo.setText("Remover");

        GroupLayout PRemoverVooLayout = new GroupLayout(PRemoverVoo);
        PRemoverVoo.setLayout(PRemoverVooLayout);
        PRemoverVooLayout.setHorizontalGroup(
                PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverVooLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(btnRemoverVoo)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverVooLayout.createSequentialGroup()
                .addComponent(lblcodid)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnConsultarVoo))
                .addGroup(PRemoverVooLayout.createSequentialGroup()
                .addComponent(lbldata)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblhora)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
                .addGroup(PRemoverVooLayout.createSequentialGroup()
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lbleconomica)
                .addComponent(lblexecutiva)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                .addComponent(txtexecutiva)
                .addComponent(txteconomica)
                .addComponent(txtdestino, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)))))
                .addContainerGap(106, Short.MAX_VALUE)));
        PRemoverVooLayout.setVerticalGroup(
                PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverVooLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodid)
                .addComponent(txtcodid, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(btnConsultarVoo))
                .addGap(24, 24, 24)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbldata)
                .addComponent(txtdata, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lblhora)
                .addComponent(txthora, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(lbleconomica)
                .addComponent(txteconomica, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(lblexecutiva)
                .addComponent(txtexecutiva, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PRemoverVooLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(txtdestino, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addComponent(btnRemoverVoo)
                .addContainerGap(40, Short.MAX_VALUE)));

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverVoo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));


    }

    public void PainelCadastrarReserva() {

        PCadastrarReserva = new JPanel();
        JButton btncadastrar = new JButton();
        JButton btnconsultar = new JButton();
        JLabel lblaeronave = new JLabel();
        JLabel lblaeroporto = new JLabel();
        JLabel lblassento = new JLabel();
        JLabel lblcodreserva = new JLabel();
        JLabel lblcodvoo = new JLabel();
        JLabel lblcpf = new JLabel();
        JLabel lbldestino = new JLabel();
        JLabel lblfileira = new JLabel();
        JLabel lblnomecliente = new JLabel();
        final JRadioButton radioexecutiva = new JRadioButton();
        final JTextField txtaeronave = new JTextField();
        final JTextField txtaeroporto = new JTextField();
        final JTextField txtassento = new JTextField();
        final JTextField txtcodreserva = new JTextField();
        final JTextField txtcodvoo = new JTextField();
        final JTextField txtcpf = new JTextField();
        final JTextField txtdestino = new JTextField();
        final JTextField txtfileira = new JTextField();
        final JTextField txtnomecliente = new JTextField();

        btnconsultar.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                                        
                    VooSerialize dados = new VooSerialize();
                    ClienteSerialize dados2 = new ClienteSerialize();
                    dados = dados.ler(txtcodvoo.getText().toString());
                    dados2 = dados2.ler(txtcpf.getText());
                    
                    txtaeroporto.setText(dados.getDestinoVoo().getNomeAeroporto());
                    txtnomecliente.setText(dados2.getNome());
                    txtaeronave.setText(dados.getAeronaveVoo().getModelo());
                    txtdestino.setText(Integer.toString(dados.getDestinoVoo().getcodigoIdentificador()));


                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente ou Voo inexistente!");
                } catch (Exception ex) {
                    Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        });

        btncadastrar.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    char charfileira;

                    charfileira = txtfileira.getText().charAt(0);
                    sistema.efetuarReserva(Integer.parseInt(txtcodreserva.getText()), Integer.parseInt(txtcodvoo.getText()), charfileira, Integer.parseInt(txtassento.getText()), radioexecutiva.isSelected(), txtcpf.getText());
                    JOptionPane.showMessageDialog(null, "Reserva Efetuada com Sucesso");
                    
                    ReservaSerialize dados = new ReservaSerialize(Integer.parseInt(txtcodreserva.getText()), charfileira, Integer.parseInt(txtassento.getText()), radioexecutiva.isSelected(), sistema.getVoo(Integer.parseInt(txtcodvoo.getText())),sistema.getCliente(txtcpf.getText()) );
                    dados.escrever(dados);
                    
                    txtcodvoo.setText("");
        txtcpf.setText("");
        txtaeroporto.setText("");
        txtnomecliente.setText("");
        txtaeronave.setText("");
        txtcodreserva.setText("");
        txtassento.setText("");
        txtfileira.setText("");
        txtdestino.setText("");

                    
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente ou Voo inexistente!");
                } catch (Exception error2) {
                    JOptionPane.showMessageDialog(null, error2.getMessage());
                }

            }
        });

        lblcodvoo.setText("Codigo Voo");
        btnconsultar.setText("Consultar Dados");
        lblcpf.setText("CPF Cliente");
        lblaeroporto.setText("Aeroporto");
        lblnomecliente.setText("Nome Cliente");
        lblaeronave.setText("Aeronave");
        lblcodreserva.setText("Codigo da Reserva");
        lblassento.setText("Assento");
        lblfileira.setText("Fileira");
        btncadastrar.setText("Cadastrar");
        radioexecutiva.setText("Executiva");
        lbldestino.setText("Destino");


        GroupLayout PCadastrarReservaLayout = new javax.swing.GroupLayout(PCadastrarReserva);
        PCadastrarReserva.setLayout(PCadastrarReservaLayout);
        PCadastrarReservaLayout.setHorizontalGroup(
                PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGap(274, 274, 274)
                .addComponent(lblassento)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtassento, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGap(270, 270, 270)
                .addComponent(radioexecutiva)
                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(lblfileira)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtfileira, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PCadastrarReservaLayout.createSequentialGroup()
                .addGap(59, 59, 59)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblaeroporto)
                .addComponent(lblcpf)
                .addComponent(lblnomecliente)
                .addComponent(lblaeronave)
                .addComponent(lbldestino))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(txtaeronave, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(txtaeroporto, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(txtcpf, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(btncadastrar)
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addComponent(lblcodreserva)
                .addGap(18, 18, 18)
                .addComponent(txtcodreserva, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PCadastrarReservaLayout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(lblcodvoo)
                .addGap(65, 65, 65)
                .addComponent(txtcodvoo, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnconsultar)))
                .addContainerGap()));
        PCadastrarReservaLayout.setVerticalGroup(
                PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtcodvoo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(btnconsultar))
                .addComponent(lblcodvoo))
                .addGap(4, 4, 4)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcpf)
                .addComponent(txtcpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblaeroporto)
                .addComponent(txtaeroporto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomecliente)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtaeronave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblaeronave))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodreserva)
                .addComponent(txtcodreserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtassento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblassento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PCadastrarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileira)
                .addComponent(txtfileira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(radioexecutiva)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btncadastrar)
                .addContainerGap(27, Short.MAX_VALUE)));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PCadastrarReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));


    }

    public void PainelRemoverReserva() {
        JButton btnConsultarReserva = new JButton();
        JButton btnremover = new JButton();
        PRemoverReserva = new JPanel();
        JLabel lblassento = new JLabel();
        JLabel lblcodreserva = new JLabel();
        JLabel lbldestino = new JLabel();
        JLabel lblfileira = new JLabel();
        JLabel lblnomecliente = new JLabel();
        final JRadioButton radioexecutiva = new JRadioButton();
        final JTextField txtassento = new JTextField();
        final JTextField txtcodreserva = new JTextField();
        final JTextField txtdestino = new JTextField();
        final JTextField txtfileira = new JTextField();
        final JTextField txtnomecliente = new JTextField();

        btnConsultarReserva.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    ReservaSerialize dados = new ReservaSerialize();
                    dados.ler(txtcodreserva.getText());

                    txtnomecliente.setText(dados.getClienteReserva().getNome());
                    txtdestino.setText(dados.getVooReserva().getDestinoVoo().getNomeCidade());
                    txtassento.setText(dados.getNumeroAssento() + "");
                    txtfileira.setText(dados.getFileiraAssento() + "");
                    radioexecutiva.setSelected(dados.isIsExecutiva());

                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente ou Voo inexistente!");
                }

            }
        });

        btnremover.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {

                    sistema.cancelarReserva(Integer.parseInt(txtcodreserva.getText()));
                    JOptionPane.showMessageDialog(null, "Reserva Cancelada com Sucesso");
                    
                    ReservaSerialize dados = new ReservaSerialize ();
                    dados.remover(txtcodreserva.getText());
                   txtcodreserva.setText("");
        txtfileira.setText("");
        txtassento.setText("");
        txtdestino.setText("");
        txtnomecliente.setText("");
        
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente ou Voo inexistente!");
                } catch (Exception error2) {
                    JOptionPane.showMessageDialog(null, error2.getMessage());
                }

            }
        });

        lblcodreserva.setText("Codigo Reserva");
        lblfileira.setText("Fileira");
        lblassento.setText("Assento");
        radioexecutiva.setText("Executiva");
        btnConsultarReserva.setText("Consultar");
        btnremover.setText("Remover");
        lbldestino.setText("Destino");
        lblnomecliente.setText("Nome Cliente");
        GroupLayout PRemoverReservaLayout = new javax.swing.GroupLayout(PRemoverReserva);
        PRemoverReserva.setLayout(PRemoverReservaLayout);
        PRemoverReservaLayout.setHorizontalGroup(
                PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addComponent(radioexecutiva)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addComponent(lblcodreserva)
                .addGap(18, 18, 18)
                .addComponent(txtcodreserva))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PRemoverReservaLayout.createSequentialGroup()
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblfileira)
                .addComponent(lblassento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(txtfileira, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                .addComponent(txtassento)))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PRemoverReservaLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(btnremover)))
                .addGap(51, 51, 51)
                .addComponent(btnConsultarReserva)
                .addGap(63, 63, 63))
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblnomecliente)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                .addComponent(txtdestino))
                .addGap(0, 0, Short.MAX_VALUE)))));
        PRemoverReservaLayout.setVerticalGroup(
                PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodreserva)
                .addComponent(txtcodreserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(btnConsultarReserva))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblfileira)
                .addComponent(txtfileira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblassento)
                .addComponent(txtassento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(radioexecutiva)
                .addGap(18, 18, 18)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomecliente)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PRemoverReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addComponent(lbldestino)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addComponent(btnremover)
                .addGap(35, 35, 35))
                .addGroup(PRemoverReservaLayout.createSequentialGroup()
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PRemoverReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    }

    public void PainelConsultarReserva() {

        PConsultarReserva = new javax.swing.JPanel();
        JLabel lblcodreserva = new JLabel();
        final JTextField txtcodreserva = new javax.swing.JTextField();
        JLabel lblnomecliente = new javax.swing.JLabel();
        final JTextField txtnomecliente = new javax.swing.JTextField();
        JLabel lblaeroporto = new javax.swing.JLabel();
        final JTextField txtaeroporto = new javax.swing.JTextField();
        JLabel lbldestino = new javax.swing.JLabel();
        final JTextField txtdestino = new javax.swing.JTextField();
        JLabel lblcodigovoo = new javax.swing.JLabel();
        final JTextField txtcodvoo = new javax.swing.JTextField();
        JLabel lblassento = new javax.swing.JLabel();
        final JTextField txtassento = new javax.swing.JTextField();
        JLabel lblfileira = new javax.swing.JLabel();
        final JTextField txtfileira = new javax.swing.JTextField();
        final JRadioButton radioexecutiva = new javax.swing.JRadioButton();
        final JButton btnConsultar = new javax.swing.JButton();

        btnConsultar.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    
                    ReservaSerialize  dados = new ReservaSerialize ();
                    dados.ler(txtcodreserva.getText());

                    txtnomecliente.setText(dados.getClienteReserva().getNome());
                    txtaeroporto.setText(dados.getVooReserva().getDestinoVoo().getNomeAeroporto());
                    txtdestino.setText(dados.getVooReserva().getDestinoVoo().getNomeCidade());
                    txtcodvoo.setText(dados.getVooReserva().getCodigoIdentificador() + "");
                    txtassento.setText(dados.getNumeroAssento() + "");
                    txtfileira.setText(dados.getFileiraAssento() + "");
                    radioexecutiva.setSelected(dados.isIsExecutiva());
                    
                    
                    /*txtnomecliente.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getClienteReserva().getNome());
                    txtaeroporto.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getVooReserva().getDestinoVoo().getNomeAeroporto());
                    txtdestino.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getVooReserva().getDestinoVoo().getNomeCidade());
                    txtcodvoo.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getVooReserva().getCodigoIdentificador() + "");
                    txtassento.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getNumeroAssento() + "");
                    txtfileira.setText(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).getFileiraAssento() + "");
                    radioexecutiva.setSelected(sistema.getReserva(Integer.parseInt(txtcodreserva.getText())).isIsExecutiva());
                    */
                } catch (NullPointerException error) {
                    JOptionPane.showMessageDialog(null, "Cliente ou Voo inexistente!");
                }

            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        lblcodreserva.setText("Codigo Reserva");
        lblnomecliente.setText("Nome Cliente");
        lblaeroporto.setText("Aeroporto");
        lbldestino.setText("Destino");
        lblcodigovoo.setText("Codigo Voo");
        lblassento.setText("Assento");
        lblfileira.setText("Fileira");
        radioexecutiva.setText("Executiva");
        btnConsultar.setText("Consultar");

        javax.swing.GroupLayout PConsultarReservaLayout = new javax.swing.GroupLayout(PConsultarReserva);
        PConsultarReserva.setLayout(PConsultarReservaLayout);
        PConsultarReservaLayout.setHorizontalGroup(
                PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addComponent(radioexecutiva)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addComponent(lblnomecliente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addComponent(lblcodreserva)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtcodreserva))
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblaeroporto)
                .addComponent(lbldestino))
                .addGap(18, 18, 18)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(txtaeroporto)
                .addComponent(txtdestino)))
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblcodigovoo)
                .addComponent(lblassento)
                .addComponent(lblfileira))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(txtcodvoo)
                .addComponent(txtfileira)
                .addComponent(txtassento))))
                .addGap(202, 202, 202))))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PConsultarReservaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnConsultar)
                .addGap(70, 70, 70)));
        PConsultarReservaLayout.setVerticalGroup(
                PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PConsultarReservaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodreserva)
                .addComponent(txtcodreserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblnomecliente)
                .addComponent(txtnomecliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblaeroporto)
                .addComponent(txtaeroporto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lbldestino)
                .addComponent(txtdestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblcodigovoo)
                .addComponent(txtcodvoo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblassento)
                .addComponent(txtassento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PConsultarReservaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(lblfileira)
                .addComponent(txtfileira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioexecutiva)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                .addComponent(btnConsultar)
                .addContainerGap()));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(PConsultarReserva, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));


    }
    //Botões do GridLayout

    class CadastrarCliente implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            CardLayout cl = (CardLayout) (cardsCliente.getLayout());

            cl.show(cardsCliente, "CadastrarCliente");
            
            
        }
    }

    class AlterarCliente implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsCliente.getLayout());

            cl.show(cardsCliente, "AlterarCliente");

        }
    }

    class RemoverCliente implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsCliente.getLayout());

            cl.show(cardsCliente, "RemoverCliente");;
        }
    }

    class ConsultarCliente implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsCliente.getLayout());

            cl.show(cardsCliente, "ConsultarCliente");
        }
    }

    class CadastrarAeronave implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsAeronave.getLayout());

            cl.show(cardsAeronave, "CadastrarAeronave");
        }
    }

    class AlterarAeronave implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsAeronave.getLayout());

            cl.show(cardsAeronave, "AlterarAeronave");

        }
    }

    class RemoverAeronave implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsAeronave.getLayout());

            cl.show(cardsAeronave, "RemoverAeronave");;
        }
    }

    class ConsultarAeronave implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsAeronave.getLayout());

            cl.show(cardsAeronave, "ConsultarAeronave");
        }
    }

    class CadastrarDestino implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsDestino.getLayout());

            cl.show(cardsDestino, "CadastrarDestino");
        }
    }

    class AlterarDestino implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsDestino.getLayout());

            cl.show(cardsDestino, "AlterarDestino");

        }
    }

    class RemoverDestino implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsDestino.getLayout());

            cl.show(cardsDestino, "RemoverDestino");;
        }
    }

    class ConsultarDestino implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsDestino.getLayout());

            cl.show(cardsDestino, "ConsultarDestino");
        }
    }

    class CadastrarVoo implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsVoo.getLayout());

            cl.show(cardsVoo, "CadastrarVoo");
        }
    }

    class AlterarVoo implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsVoo.getLayout());

            cl.show(cardsVoo, "AlterarVoo");

        }
    }

    class RemoverVoo implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsVoo.getLayout());

            cl.show(cardsVoo, "RemoverVoo");;
        }
    }

    class ConsultarVoo implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsVoo.getLayout());

            cl.show(cardsVoo, "ConsultarVoo");
        }
    }

    class CadastrarReserva implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsReserva.getLayout());

            cl.show(cardsReserva, "CadastrarReserva");
        }
    }

    class RemoverReserva implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsReserva.getLayout());

            cl.show(cardsReserva, "RemoverReserva");;
        }
    }

    class ConsultarReserva implements ActionListener {

        public void actionPerformed(ActionEvent event) {
            
            CardLayout cl = (CardLayout) (cardsReserva.getLayout());

            cl.show(cardsReserva, "ConsultarReserva");;
        }
    }
//    public static void main(String[] args) {
//        Interface i = new Interface();
//    }
    // Variables declaration - do not modify
    JFrame frame = new JFrame("Air Turtle v1.0");
    //Criando as abas
    private JTabbedPane Abas;
    //Criando cards
    private JPanel cardsCliente;
    private JPanel cardsAeronave;
    private JPanel cardsDestino;
    private JPanel cardsVoo;
    private JPanel cardsReserva;
    //Criando os paineis
    //Painel único da Home
    private JPanel PHome;
    //Painéis do Cliente
    private JPanel PCliente;
    private JPanel PCadastrarCliente;
    private JPanel PConsultarCliente;
    private JPanel PAlterarCliente;
    private JPanel PRemoverCliente;
    //Painéis da Aeronave
    private JPanel PAeronave;
    private JPanel PCadastrarAeronave;
    private JPanel PConsultarAeronave;
    private JPanel PAlterarAeronave;
    private JPanel PRemoverAeronave;
    //Painéis do Destino
    private JPanel PDestino;
    private JPanel PCadastrarDestino;
    private JPanel PConsultarDestino;
    private JPanel PAlterarDestino;
    private JPanel PRemoverDestino;
    //Painéis do Voo
    private JPanel PVoo;
    private JPanel PCadastrarVoo;
    private JPanel PConsultarVoo;
    private JPanel PAlterarVoo;
    private JPanel PRemoverVoo;
    //Painéis do Reserva
    private JPanel PReserva;
    private JPanel PCadastrarReserva;
    private JPanel PConsultarReserva;
    private JPanel PAlterarReserva;
    private JPanel PRemoverReserva;
    //Painel do Faturamento
    private JPanel PFaturamento;
    //Criando os botoes Cliente
    private JButton BCadastrarCliente;
    private JButton BAlterarCliente;
    private JButton BRemoverCliente;
    private JButton BConsultarCliente;
    private JButton btnConfirmarCadastro;
    //Criando os botoes Aeronave
    private JButton BCadastrarAeronave;
    private JButton BAlterarAeronave;
    private JButton BRemoverAeronave;
    private JButton BConsultarAeronave;
    //Criando os botoes Destino
    private JButton BCadastrarDestino;
    private JButton BAlterarDestino;
    private JButton BRemoverDestino;
    private JButton BConsultarDestino;
    //Criando os botoes Voo
    private JButton BCadastrarVoo;
    private JButton BAlterarVoo;
    private JButton BRemoverVoo;
    private JButton BConsultarVoo;
    //Criando os botoes Reserva
    private JButton BCadastrarReserva;
    private JButton BAlterarReserva;
    private JButton BRemoverReserva;
    private JButton BConsultarReserva;
    //Criando o botao Faturamento
    private JButton BCalcular;
}
